即时通讯使用objectFromJSONData收到警告 [英] im getting a warning using objectFromJSONData

查看:155
本文介绍了即时通讯使用objectFromJSONData收到警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目标C应用程序编译成功,但是我收到Xcode警告:

my objective C app compiles successfully, but i get an Xcode warning:

Instance method '-objectFromJSONData' not found (return type defaults to 'id')

在此行:

NSDictionary *userInfo = [data objectFromJSONData];

我如何摆脱该警告?

推荐答案

制作自定义类或使用在Apple之外构建的类时,需要导入所用框架或类的标头.这使编译器可以交叉检查返回类型等等.

When you make a custom class or use a class built outside of apple, you need to import the headers for the framework or class you are using. This allows the compiler to cross check return types and so forth.

当您尝试发送有效消息(但编译器不知道)时,您会收到该警告.该代码应该可以运行并在那里处理警告,但是很高兴您希望摆脱警告.

When you attempt to send valid messages (but the compiler is unaware of) you will get that warning. The code should run and work with the warning there, but I am glad you want to get rid of the warning.

与您发布的代码在同一.m文件中...靠近顶部...添加

in the same .m file as the code you posted... near the top... add

#import "JSONKit.h"

这篇关于即时通讯使用objectFromJSONData收到警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆