我收到以下错误:
我看不出我的代码有什么问题。这是我的 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];
} }];
这些有错吗?