jsonkit

The JKDictionary class is private to JSONKit and should not be used in this fashion

天大地大妈咪最大 提交于 2019-12-11 05:05:56
问题 This is a followup question to this In short, I'm making my app ios 4.3 compatible and using the AFNetworking class version 0.10.1 that supports ios 4 in my app. This line self.responseJSON = AFJSONDecode(self.responseData, &error); gives me the error bellow. I'm not really familiar with jason and trying to figure out what this error means. Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** - [JKDictionary allocWithZone:]: The JKDictionary class is private to

Performance of object_setClass() instead of assigning isa pointer

只愿长相守 提交于 2019-12-10 11:18:28
问题 I noticed with with the latest update to XCode (4.6), I was given a warning about a couple of lines in JSONKit.m . Specifically, lines that set the class of an object: dictionary->isa = _JKDictionaryClass; These are marked as deprecated with a note that the preferred method was to use object_setClass() : object_setClass(dictionary, _JKDictionaryClass); When I asked why it was preferred to simply silence the warning, the response was: Everything works fine even if new Xcode version complains,

Performance of object_setClass() instead of assigning isa pointer

蓝咒 提交于 2019-12-06 10:08:32
I noticed with with the latest update to XCode (4.6), I was given a warning about a couple of lines in JSONKit.m . Specifically, lines that set the class of an object: dictionary->isa = _JKDictionaryClass; These are marked as deprecated with a note that the preferred method was to use object_setClass() : object_setClass(dictionary, _JKDictionaryClass); When I asked why it was preferred to simply silence the warning, the response was: Everything works fine even if new Xcode version complains, I don't want to : 1) test each project where i use JSONKit to check if everything goes fine after

iOS 7 : 'isa' is deprecated

血红的双手。 提交于 2019-12-04 11:53:40
问题 I get warning when I run my app in iOS7 "'isa' is deprecated", I don't have any idea how to fix this warning message. Please any one help on this. array->isa = _JKArrayClass; 回答1: Include <objc/runtime.h> . Replace everything like array->isa = _JKArrayClass; with object_setClass(array, _JKArrayClass) And everything like class = array.isa with class = object_getClass(array) 回答2: I figured I would share my solution for you Cocoapods users out there. (Please let me know in the comments if you

JSONkit sorting issues

天大地大妈咪最大 提交于 2019-12-04 06:41:41
问题 I am using a REST based web service to get data. No matter what the structure of the JSON document, the NSDictionary gets populated the same way. I want the sorting preserved as the web service returns. Here is my code: -(void) getData { NSURL *url = [NSURL URLWithString:@"http://somewebservice"]; __block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; [request setCompletionBlock:^{ // Use when fetching text data NSString *responseString = [request responseString]; NSDictionary

JSONKit benchmarks

巧了我就是萌 提交于 2019-12-03 06:12:35
I pulled the code from http://www.bonto.ch/blog/2011/12/08/json-libraries-for-ios-comparison-updated/ and tested it on my local machine. I was surprised by the results and NSJSonSerialization gave much better performance than JSONKit . Has NSJSonSerialization really overtaken JSONKit in terms of speed or did I do something wrong? twitter_timeline.json repeat.json random.json You have not done anything wrong. Things have changed in iOS 6. Apple have greatly improved the performance of NSJSONSerialization . When using iOS 6 and up, it is the fastest. JSONKit has also not been updated in a year.

is there an example of AFHTTPClient posting json with AFNetworking?

隐身守侯 提交于 2019-12-03 02:44:48
Looking for an example of how to post json with AFHTTPClient . I see that there is a postPath method which takes an NSDictionary and the AFJSONEncode method returns an NSData . Is there an easy way to serialize an object to NSDictionary , or is there an easier way using jsonkit? I just need to post the object as json to a REST API. UPDATE: So I tried passing a dictionary over but it seems to break on serializing a nested array. For example, if I have an object: Post* p = [[Post alloc] init]; p.uname = @"mike"; p.likes =[NSNumber numberWithInt:1]; p.geo = [[NSArray alloc] initWithObjects:

组件化pod库制作之私有库制作

与世无争的帅哥 提交于 2019-11-30 21:57:56
私有podspec制作步骤: 组件化方案一般都是采用私有podspec 1、创建私有Spec Repo Spec Repo 是所有公开的Pods 的podspec文件的一个git仓库,当使用Cocoapods后它会被clone到本地的~/.cocoapods/repos目录下,可以进入到这个目录看到master文件夹就是这个官方的Spec Repo了。因此我们需要创建一个类似于master的私有Spec Repo 。同理这个私有Spec Repo我们也要有一个远程端。那么我们需要创建一个 Git仓库,这个仓库你可以创建私有的也可以创建公开的。如果是私有的话,项目中其他同事,你要给他这个Git仓库的权限。组件化一般都是采用私有的。 在git管理的代码托管网站如github或者码云或则自己服务器上创建一个私有仓库: # pod repo add [Private Repo Name] [GitHub HTTPS clone URL] 如:$ pod repo add HFPodSpecs https://coding.net/xxxx/ HFPodSpecs .git 其中HFPodSpecs是私有 Spec Repo名称 此时如果成功的话进入到~/.cocoapods/repos目录下就可以看到WTSpecs这个目录了。至此第一步创建私有Spec Repo完成。 PS

组件化pod库制作之私有库制作

两盒软妹~` 提交于 2019-11-29 13:25:20
私有podspec制作步骤: 组件化方案一般都是采用私有podspec 1、创建私有Spec Repo Spec Repo 是所有公开的Pods 的podspec文件的一个git仓库,当使用Cocoapods后它会被clone到本地的~/.cocoapods/repos目录下,可以进入到这个目录看到master文件夹就是这个官方的Spec Repo了。因此我们需要创建一个类似于master的私有Spec Repo 。同理这个私有Spec Repo我们也要有一个远程端。那么我们需要创建一个 Git仓库,这个仓库你可以创建私有的也可以创建公开的。如果是私有的话,项目中其他同事,你要给他这个Git仓库的权限。组件化一般都是采用私有的。 在git管理的代码托管网站如github或者码云或则自己服务器上创建一个私有仓库: # pod repo add [Private Repo Name] [GitHub HTTPS clone URL] 如:$ pod repo add HFPodSpecs https://coding.net/xxxx/ HFPodSpecs .git 其中HFPodSpecs是私有 Spec Repo名称 此时如果成功的话进入到~/.cocoapods/repos目录下就可以看到WTSpecs这个目录了。至此第一步创建私有Spec Repo完成。 PS

组件化pod库制作

时光毁灭记忆、已成空白 提交于 2019-11-29 08:54:30
一)、组件化的目的: 1、解耦各模块和业务,便于开发维护 2、构建可复用模块,便于复用 3、由于开发人员很多时,合作开发代码很容易冲突等,沟通成本很高,让各模块做成组件,每个人只负责某一模块,让开发更有效率 4、提高工程编译速度,当工程很大时,编译是一个十分耗时的过程,各模块做成组件,前期做功能时,只需关注编译自己的模块工程,减少总的编译时间 5、便于模块化测试,可以单独测试各组件模块 二)、组件化的类型:公有和私有podspec 1、使用Cocoapods创建公有podspec 2、使用Cocoapods创建私有podspec 三)、公有podspec制作步骤: 当然你电脑安装了cocoaPods了, 1、注册trunk 查看自己是否注册过trunk $pod trunk me 注册trunk $ pod trunk register 邮箱 ‘你的名称’ —description=‘电脑机型描述’ 如:$ pod trunk register zhangsan @163.com ‘zhangsan’ —description=‘MacBook Pro’ 注册后,cocoapods官方会向你邮箱发送确认邮件,点击确认即可. 确认后,可以再使用 $pod trunk me 查看个人信息 2、创建项目工程,并上传到github上,获得项目代码地址 https://github.com