小编Eri*_*ins的帖子

NSMutableDictionary上的EXC_BAD_ACCESS

我开始iOS开发,我有这个代码:

首先我声明listOfItems NSMutableArray:

@interface SAMasterViewController () {
    NSMutableArray *listOfItems;
}
@end
Run Code Online (Sandbox Code Playgroud)

现在,这是代码的一部分,它给了我一个"EXC_BAD_ACCESS(代码= 1,地址= 0x5fc260000)"错误.错误在"individual_data"对象的最后一行中给出.

listOfItems = [[NSMutableArray alloc] init];
for(NSDictionary *tweetDict in statuses) {
    NSString  *text          = [tweetDict objectForKey:@"text"];
    NSString  *screenName    = [[tweetDict objectForKey:@"user"] objectForKey:@"screen_name"];
    NSString  *img_url       = [[tweetDict objectForKey:@"user"] objectForKey:@"profile_image_url"];
    NSInteger unique_id      = [[tweetDict objectForKey:@"id"] intValue];
    NSInteger user_id        = [[[tweetDict objectForKey:@"user"] objectForKey:@"id"] intValue ];

    NSMutableDictionary *individual_data = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                            text, @"text_tweet",
                                            screenName,@"user_name",
                                            img_url, @"img_url",
                                            unique_id, @"unique_id",
                                            user_id, @"user_id", nil];
    [listOfItems addObject:individual_data];
}
Run Code Online (Sandbox Code Playgroud)

提前致谢.

iphone exc-bad-access objective-c nsmutabledictionary ios

1
推荐指数
1
解决办法
2113
查看次数