循环遍历NSDictionary时“无法恢复以前选择的帧”

时间:2011-09-12 09:20:25

标签: iphone ios ios4 nsarray nsdictionary

我的应用中出现以下错误:

warning:Unable to restore previously selected frame
warning:Unable to restore previously selected frame

使用以下代码时:

NSDictionary *feed = [json_parser objectWithString:json_str error:nil];
for(NSDictionary *feed_item in [feed objectForKey:@"items"])
{
    PropertyData *propertyData; // mere data model class with properties only,no methods
    [propertyData release];
}

此行突出显示主题1:收到收到的信号:“EXC_BAD_ACCESS”

[propertyData release];

在解析之前,json字符串看起来如下所示(因此您可以理解数据的结构,但解析工作正常):

{
    "total":110,"page":1,
    "items":[
        {"pid":"1349","price":"52,000","type":"Apartment","beds":"","descr1":"<p></p>"},
        {"pid":"1349","price":"52,000","type":"Apartment","beds":"","descr1":"<p></p>"},
        {"pid":"1349","price":"52,000","type":"Apartment","beds":"","descr1":"<p></p>"}
    ]
}

知道什么是错的?

求助,

的Stephane

1 个答案:

答案 0 :(得分:1)

您没有分配/初始化PropertyData。指针指的是内存中的一些随机位置,然后你发送它“释放”消息,导致EXC_BAD_ACCESS,