草庐IT

NSdictionary

全部标签

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

iphone - 如何根据 tableviewcell 选择将 subview 的 nsdictionary 保存到主视图

我目前正在解析一些看起来像这样的xml我解析它以便有一个字典数组(每个字典中都有Row的四个值)。然后我像这样将ManufacturerName传递给我的startSortingTheArray方法if(dataSetToParse==@"ICMfg")//ICMfgisastringpassedtothisviewfromtheparentviewcellselectionenablingmetopassdifferentdatasetstothisview{//Filterresults(ISAUTO=T)NSPredicate*predicate=[NSPredicatepred

objective-c - 如何检查 NSDictionary 中的类

在下面的字典中我想写一个类型类的条件,有没有办法在迭代中单独识别类类型NSDictionary*dictionary=[NSDictionarydictionaryWithKeysAndObjects:@"check",@"checkValue",@"webservice",[webserviceclass],@"list",@"listValue",nil,@"task",[taskclass],@"new",@"newValue",@"operation",[operationclass]];for(NSString*aKeyindictionary){if([[dictionar

iphone - 计算 NSDictionary 中的 allKeys 返回 EXC_BAD_ACCESS

我正在尝试将NSDictionary发送到TableViewController,数据最初来自.plist文件。我只想将存在于层次结构下方的对象发送到新的TableViewController。但是当我尝试计算numberOfSectionsInTableView中的项目数时出现问题。-(void)tableView:(UITableView*)tableViewdidSelectRowAtIndexPath:(NSIndexPath*)indexPath{//GetsthedictionaryforthecurrentlyselectedrowNSDictionary*dict=[[