【问题标题】:"Unable to restore previously selected frame" when looping through NSDictionary循环通过 NSDictionary 时“无法恢复先前选择的帧”
【发布时间】:2011-09-12 09:20:24
【问题描述】:

我的应用出现以下错误:

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>"}
    ]
}

知道哪里出了问题吗?

感谢您的帮助,

斯蒂芬

【问题讨论】:

  • 你能在这里发布崩溃日志/堆栈跟踪吗?
  • 只是“警告:无法恢复先前选择的帧”多次而已
  • 我发现了问题所在:PropertyData *propertyData;它应该是: PropertyData *propertyData = [[PropertyData alloc] init];总之,使用前先分配……谢谢!

标签: iphone ios ios4 nsarray nsdictionary


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2011-03-04
    • 1970-01-01
    • 2012-11-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-26
    • 1970-01-01
    • 2011-02-27
    相关资源
    最近更新 更多