草庐IT

nsdictionary

全部标签

ios - NSDictionary 为零

我想解析一个本地json,我正试图这样做,但是testDict是nil。谁能帮帮我吗?-(void)filterContentForSearchText:(NSString*)searchTextscope:(NSString*)scope{[self.searchResultremoveAllObjects];NSPredicate*resultPredicate=[NSPredicatepredicateWithFormat:@"SELFcontains[c]%@",searchText];NSString*firstLetter=[searchTextsubstringWithR

ios - 在 iOS 中使用 NSDictionary 的可扩展 UITableview 单元格

这是我的代码:Viewcontroller.m@interfaceViewController(){NSArray*sectionTitleArray;NSMutableArray*arrayForBool;NSArray*aboutStep0neArray;NSArray*profileArray;}@property(nonatomic,strong)IBOutletUITableView*tablevw;-(void)viewDidLoad{[superviewDidLoad];_tablevw.delegate=self;_tablevw.dataSource=self;arr

ios - 访问 [AnyHashable : Any] as NSDictionary 中的信息

我正在将我的代码从ObjectiveC转换为Swift。我有一个代码,它从一个swift方法调用一个objective-c方法。objC方法返回一个NSDictionary。显然Swift将此对象视为类型[AnyHashable:Any]。如何阅读该类型的信息?例如,对于NSDictionary,我会说NSString*s=[dictobjectForKey:"key"]。我在Swift中调用什么来访问[AnyHashable:Any]类型的值?谢谢 最佳答案 尝试使用下面的代码来解包你的结果:ifletdict=dictasNSD

iphone - 如何将具有空键的 JSON 解析为 NSDictionary?

我收到一个JSON响应,其中包含一个空键(""):{"errors":{"":["Wrongemailandpasswordcombination"]}}可以使用JSONKit将此JSON正确解析为NSDictionary吗? 最佳答案 如果它是数据部分并且您使用的是TouchJSON,它通常会被解释为null并在字典中设置为NSNull对象而不是NSString。(您可以与[NSNullnull]进行比较)。不确定JSONKit会发生什么,或者它是一个键而不是一个值是否会对此产生任何影响(我假设不会,但如果它被解释为NSNull键

ios - 给定 JSON 对象的 NSArray,如何在 NSDictionary 中存储同一个键的多个值?

我知道不可能为同一个键设置多个值,除非这些值存储在数组中。我有一个名为friMainDicArray的JSON对象的NSArray:{day=0;"end_time"="17:30";"english_event"="LionDance";"english_performer"="LegendaryGroup";"image_link"="schedule_miss_vn";stage=0;"start_time"="17:00";"viet_event"="";"viet_performer"="Nh?mLegendary";},{day=0;"end_time"="18:00";"

ios - MOTIS 对象映射,使用 NSDictionary 和值 NSArray 如何指定数组元素的类型?

我有json{"Types":{"food":[{"cve":"1","description":"Pizza"},{"cve":"2","description":"Restaurant"},{"cve":"3","description":"Cafe"}],"Health":[{"cve":"3","description":"Pharmacy"},{"cve":"4","description":"Hospital"}]}}类型.h#import@interfaceTypes:NSObject@property(nonatomic,copy)NSDictionary*types;

ios - 带有 AFNetworking 的嵌套 NSDictionary 和 NSArray 无法正常工作

NSDictionary*customerDictionary=[NSDictionarydictionaryWithObjectsAndKeys:@"blah@blah.com",@"email",@"1",@"facebook",nil];NSArray*customerArray=[NSArrayarrayWithObjects:customerDictionary,nil];NSDictionary*parameters=[NSDictionarydictionaryWithObjectsAndKeys:customerArray,@"customers",nil];NSURL

ios - 从 NSDictionary : NSNumber vs NSString 存储和检索 int64_t

我正在开发一款具有GameCenter功能的游戏。在内部,我的游戏将所有分数保存在int64_t类型的变量中,因为这是通过GameKitAPI报告分数所需的类型(我假设这是为了避免32之间的歧义位和64位平台)。到目前为止,还不错。接下来,我希望在没有经过身份验证的GameCenter播放器时将用户的hiscore存储在本地(例如,在NSUserDefaults中。但是.plist是等效的),并通过iCloud同步它键值与用户拥有的其他设备。我可以像这样存储int64_thiscore://(int64_t)_hiscoreisanivar.//(NSString)_playerIDi

ios - 在 NSDictionary 中传递 NSDate 并转换为 NSData 以进行 jsondata 修复

我有一个包含NSString和NSDate数据的json(dob)我创建了它的NSDictionary,但是当我使用代码将它转换为数据时NSData*requestData1=[NSJSONSerializationdataWithJSONObject:json_inputDicoptions:0error:&error];它通过给出错误来杀死Terminatingappduetouncaughtexception'NSInvalidArgumentException',reason:'InvalidtypeinJSONwrite(__NSDate)'我的问题是我需要通过dob,因为N

ios - 如何让我的 AFNetworking "responseObject"收到我可以解析的 NSDictionary?

我对AFNetworking1.0进行了调用,它返回一个responseObject,其中包含我想要的API中的数据:[[AFDiffbotClientsharedClient]postPath:@"http://diffbot.com/api/batch"parameters:parameterssuccess:^(AFHTTPRequestOperation*operation,idresponseObject){但是,我不知道如何处理responseObject。如果我检查[responseObjectclass],我会得到NSData。如果我NSLog(@"%@",respon