Recently encountered a question about Jsonkit, after the project added ARM7 64, Jsonkit will appear [params jsonstring] forkey:@ "Gson"]; Error cases, such as
The specific reason is not very clear, this is the new problem that iOS9 appears, it seems that the dictionary has a problem when it becomes a string. The following solutions are directly attached:
Locate the JSONKit.h file, locate the @interface nsdictionary (jsonkitserializing) in the JSONKit.h file, and add a xmjsonstring method to it, such as
Locate the jsonkit.m file, implement the method you just added in the jsonkit.m file, and implement the
Attach the implementation code:
- (NSString *) XMJSOnstring{Nserror *error =NilNSData *jsondata = [Nsjsonserialization Datawithjsonobject:Self options:Nsjsonwritingprettyprinted error:&error];if ([jsondata length] && error = = nil) { NSString *jsonstring = [[nsstring alloc] initwithdata:jsondata encoding: nsutf8stringencoding]; nsstring *replacestring = [jsonstring stringbyreplacingoccurrencesofstring: @ "\ n" withstring:@ ""]; nsstring *treplacestring = [replacestring stringbyreplacingoccurrencesofstring:@" \ \ "Withstring:@" "]; return [treplacestring stringbyreplacingoccurrencesofstring:@ "" Withstring:@ ""]; }else{return nil;}
PS: If you do not know how to add a method, you can go to the cloud disk to download the rewritten jsonkit. h and. m files, and then directly replace the two files on the line. Here is the cloud Disk link: http://pan.baidu.com/s/1gd59ed9 Password: S5eh
Note that after the file is replaced, Jsonkit may have 19 errors on the arc, find the Targets-build phases in the project, add the settings like
Finally, don't forget to use the method here instead of the method you just added (-(NSString *) xmjsonstring) Oh. The format is:
[request addPostValue:[params XMJSONString]];if (type.length != 0) {}
Jsonkit problems in the 64-bit iOS9 ARM7