【发布时间】:2013-12-01 22:39:46
【问题描述】:
我的应用程序会显示 Instagram 图片的标题,并且每次没有标题时都会崩溃。我将如何防止这种情况发生?这是我正在使用的代码:
if (entry[@"caption"][@"text"]) {
NSString *caption = entry[@"caption"][@"text"];
UILabel *instagramCaptionLabel = (UILabel *)[cell viewWithTag:103];
[instagramCaptionLabel setFont:[UIFont fontWithName:@"Helvetica-Light" size:12.0]];
[instagramCaptionLabel setText:caption];
}
这是错误:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull objectForKeyedSubscript:]: unrecognized selector sent to instance 0x1ed8068'
【问题讨论】:
-
每当您发布有关错误的问题时,您必须包括准确和完整的错误,并指出导致错误的确切代码行。
标签: ios objective-c cocoa-touch nsdictionary instagram