<extracting data from value failed> in NSDictionary

不打扰是莪最后的温柔 提交于 2019-12-04 19:09:57

问题


I am stuck at a point when I convert data from web services to NSDictionary. But while accessing on console in debug mode it returns , while when i bind the values of dictionary with view it works perfectly. Below is the code:-

NSDictionary *responseDict =  [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&e];

and at console i am using po [dictName valueForKey:@"Status"] as well as po [dictName objectForKey:@"Status"]. Followed few steps but does not work for me 1. setting Optimization level to none already in this mode. 2.Edit scheme to debug mode already in this mode.


回答1:


I meet this problem when I try to get information from Info.plist. Finally I use a string exchange.

NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"Info"ofType:@"plist"];
    NSMutableDictionary *data = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath];
    NSString *version = [data objectForKey:@"CFBundleShortVersionString"];
    self.labVersion.text = [NSString stringWithFormat:@"(%@)", version];


来源:https://stackoverflow.com/questions/40924336/extracting-data-from-value-failed-in-nsdictionary

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!