Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<extracting data from value failed> in NSDictionary

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.

like image 935
Anupam Gupta Avatar asked Dec 02 '16 03:12

Anupam Gupta


1 Answers

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];
like image 68
Qiang Ye Avatar answered Nov 04 '22 00:11

Qiang Ye