1

I'm trying to use JSON parsing from RestKit, but I'm receiving the following compile time error:

Undefined symbols for architecture armv7: 
"_OBJC_CLASS_$_RKJSONParserJSONKit", referenced from: 
  objc-class-ref in FloorMapLoaderViewController.o 
ld: symbol(s) not found for architecture armv7 
clang: error: linker command failed with exit code 1 (use -v to see 
invocation) 

RestKit works ok, this being the only error I've seen so far. This is my import line:

#import <RestKit/Support/JSON/JSONKit/RKJSONParserJSONKit.h> 

edit: oddly, it fails to compile only if I try to create a parser like so:

 RKJSONParserJSONKit *parser = [RKJSONParserJSONKit new];

Commenting out this line allows for compilation, but I do need to instance a parser.

How can I fix this error? Thank you.

4

1 回答 1

2

导入意味着您的源代码可以看到 API,因此 IDE 知道如何自动完成,因此编译器知道如何生成正确的目标代码。

你有一个链接器错误。一旦您自己的代码被编译,它必须与它所依赖的所有代码捆绑在一起(不包括动态链接的系统库)。您的链接器告诉您,将它可以找到的所有内容捆绑在一起后,并非所有内容都在那里。

您需要做的是转到您正在构建的目标,选择Build Phases选项卡,并将必要的库添加到“Link Binary With Libraries”部分。

于 2011-10-25T14:17:00.460 回答