- (voID)searchbarSearchbuttonClicked:(UISearchbar *)searchbar{ // yada yada NSURL *url = [NSURL URLWithString:@"http://localhost/file.Json"]; // the file is a valID Json ASIhttpRequest *request = [ASIhttpRequest requestWithURL:url]; [request setDelegate:self]; [request setTimeOutSeconds:20]; // Response takes too long on local machine [request startAsynchronous];}- (voID)requestFinished:(ASIhttpRequest *)request { responseString = [request responseString]; // request type: ASIREQUEST,responseString is declared as Nsstring NSLog(@"%@ \n",[responseString class]); // NSCFString NSDictionary *deserializedData = [responseString objectFromJsONString];}
但是,我在应用程序运行时看到以下异常:
[7646:207] -[NSCFString objectFromJsONString]: unrecognized selector sent to instance 0xdba0000[7646:207] *** Terminating app due to uncaught exception 'NSinvalidargumentexception',reason: '-`[NSCFString objectFromJsONString]: unrecognized selector sent to instance 0xdba0000'`
可能导致此异常的原因是什么?为什么它显示我在这里使用NSCFString,即使我指定了Nsstring?
解决方法 你已经包含了JsONKit.h,但是你忘了在项目中包含JsONKit.m.它编译得很好,但实现不是在运行时. 总结以上是内存溢出为你收集整理的objective-c – ObjC / iOS:NSCFString不是NSString?全部内容,希望文章能够帮你解决objective-c – ObjC / iOS:NSCFString不是NSString?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)