<从值中提取数据失败>在NSDictionary中 [英] <extracting data from value failed> in NSDictionary

查看:109
本文介绍了<从值中提取数据失败>在NSDictionary中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将数据从Web服务转换为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];

在控制台我正在使用 po [dictName valueForKey:@Status ] 以及po [dictName objectForKey:@Status]
按照几个步骤但对我不起作用
1.在此模式下将优化级别设置为无。
2.在此模式下编辑调试模式的方案。

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.

推荐答案

当我试图获取时,我遇到了这个问题来自 Info.plist 的信息。最后我使用字符串交换。

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];

这篇关于<从值中提取数据失败>在NSDictionary中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆