问题
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