2 mapmapm MapMapM 于 2013.02.03 10:42 提问

NSMutableDictionary的问题

IOS开发代码:

listOfItems NSMutableArray声明:

@interface SAMasterViewController () {
    NSMutableArray *listOfItems;
}
@end

现在,有一部分代码报出错误:EXC_BAD_ACCESS (code=1, address=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];
}

1个回答

wangyaninglm
wangyaninglm   Ds   Rxr 2015.01.13 23:42

你可以参考一下这个帖子的解决办法:
http://www.cocoachina.com/bbs/read.php?tid=100505

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!