次のエラーが発生します。
コードのどこが悪いのかわからない。これが私のAHInstagramImageDataのコードです
-(id)initWithData:(NSDictionary *)data
{
self = [super init];
if (!self) {
return nil;
}
for (NSDictionary * comment in imgCmt){
AHInstagramImageComment * instagramImgComment = [[AHInstagramImageComment alloc] initWithData:comment];
[comments insertObject:instagramImgComment atIndex:0];
[instagramImgComment release];
}
}
and then on the AHInstagramImageComment I have:
-(id)initWithData:(NSDictionary *)data
{
self = [super init];
if (!self) {
return nil;
}
[self calculateCommentsHeight];
return self;
}
- (void) calculateCommentsHeight
{
NSString *combinedComment = [NSString stringWithFormat:@"%@ %@", self.username, self.text];
CGFloat desiredHeight = [combinedComment sizeWithFont:[UIFont fontWithName:@"HelveticaNeue" size:14] constrainedToSize:CGSizeMake(kCommentsMaxWidth, CGFLOAT_MAX) lineBreakMode:UILineBreakModeClip].height;
if (desiredHeight >= 50){
commentHeight_ = desiredHeight;
} else {
commentHeight_ = 50;
}
commentHeight_ += kTimestampMaxHeight;
commentHeight_ += 5;
}
本質的に、バックグラウンドキューでAHInstagramImageDataを初期化する必要がありました。
[weakSelf.backgroundQueue_ addOperationWithBlock:^{
NSArray *arr = [response valueForKey:@"data"];
int startingIndex = [[AHImageDataSource sharedDataSource] count];
for (NSDictionary * data in arr){
AHInstagramImageData * imgData = [[AHInstagramImageData alloc] initWithData:data];
}}];
これらのいずれかが間違っていますか?