导入restkit JSONParser错误

时间:2012-11-05 08:44:55

标签: objective-c ios restkit

我在我的项目中使用restkit我试图设置解析器的配置
通过:

[[RKParserRegistry sharedRegistry] setParserClass:[RKJSONParserJSONKit class] forMIMEType:@"text/javascript"];

我在restkit文档中导入了解析器的库

#import <RestKit/JSONKit.h>

但始终是错误

  

使用未声明的标识符&#39; RKJSONParserJSONKit&#39;

我也尝试通过以下方式从其位置导入标题来修复它:

#import <RestKit/Code/Support/Parsers/JSON/RKJSONParserJSONKit.h>  

它不起作用,但当我尝试复制解析器所需的文件并将其作为文件添加到我的项目时,liker给了我:

  

重复符号_OBJC_METACLASS _ $ _ RKJSONParserJSONKit in:       /Users/reserveout/Desktop/ReserveOutApplication/Build/Intermediates/ReserveOutApplication.build/Debug-iphonesimulator/ReserveOutApplication.build/Objects-normal/i386/RKJSONParserJSONKit.o       /Users/reserveout/Desktop/ReserveOutApplication/Build/Products/Debug-iphonesimulator/libRestKit.a(RKJSONParserJSONKit.o)   重复符号_OBJC_CLASS _ $ _ RKJSONParserJSONKit in:       /Users/reserveout/Desktop/ReserveOutApplication/Build/Intermediates/ReserveOutApplication.build/Debug-iphonesimulator/ReserveOutApplication.build/Objects-normal/i386/RKJSONParserJSONKit.o       /Users/reserveout/Desktop/ReserveOutApplication/Build/Products/Debug-iphonesimulator/libRestKit.a(RKJSONParserJSONKit.o)   重复符号_RKLogInitialize in:       /Users/reserveout/Desktop/ReserveOutApplication/Build/Intermediates/ReserveOutApplication.build/Debug-iphonesimulator/ReserveOutApplication.build/Objects-normal/i386/RKLog.o       /Users/reserveout/Desktop/ReserveOutApplication/Build/Products/Debug-iphonesimulator/libRestKit.a(RKLog.o)   重复符号_RKLogConfigureFromEnvironment in:       /Users/reserveout/Desktop/ReserveOutApplication/Build/Intermediates/ReserveOutApplication.build/Debug-iphonesimulator/ReserveOutApplication.build/Objects-normal/i386/RKLog.o       /Users/reserveout/Desktop/ReserveOutApplication/Build/Products/Debug-iphonesimulator/libRestKit.a(RKLog.o)   重复符号_RKLogLevelForString:       /Users/reserveout/Desktop/ReserveOutApplication/Build/Intermediates/ReserveOutApplication.build/Debug-iphonesimulator/ReserveOutApplication.build/Objects-normal/i386/RKLog.o       /Users/reserveout/Desktop/ReserveOutApplication/Build/Products/Debug-iphonesimulator/libRestKit.a(RKLog.o)   重复符号_RKLogValidationError:       /Users/reserveout/Desktop/ReserveOutApplication/Build/Intermediates/ReserveOutApplication.build/Debug-iphonesimulator/ReserveOutApplication.build/Objects-normal/i386/RKLog.o       /Users/reserveout/Desktop/ReserveOutApplication/Build/Products/Debug-iphonesimulator/libRestKit.a(RKLog.o)   重复符号_RKLogIntegerAsBinary:       /Users/reserveout/Desktop/ReserveOutApplication/Build/Intermediates/ReserveOutApplication.build/Debug-iphonesimulator/ReserveOutApplication.build/Objects-normal/i386/RKLog.o       /Users/reserveout/Desktop/ReserveOutApplication/Build/Products/Debug-iphonesimulator/libRestKit.a(RKLog.o)   重复符号_lcl_configure_by_component in:       /Users/reserveout/Desktop/ReserveOutApplication/Build/Intermediates/ReserveOutApplication.build/Debug-iphonesimulator/ReserveOutApplication.build/Objects-normal/i386/lcl.o       /Users/reserveout/Desktop/ReserveOutApplication/Build/Products/Debug-iphonesimulator/libRestKit.a(lcl.o)   重复符号_lcl_configure_by_identifier in:       /Users/reserveout/Desktop/ReserveOutApplication/Build/Intermediates/ReserveOutApplication.build/Debug-iphonesimulator/ReserveOutApplication.build/Objects-normal/i386/lcl.o       /Users/reserveout/Desktop/ReserveOutApplication/Build/Products/Debug-iphonesimulator/libRestKit.a(lcl.o)   重复符号__lcl_component_identifier in:       /Users/reserveout/Desktop/ReserveOutApplication/Build/Intermediates/ReserveOutApplication.build/Debug-iphonesimulator/ReserveOutApplication.build/Objects-normal/i386/lcl.o       /Users/reserveout/Desktop/ReserveOutApplication/Build/Products/Debug-iphonesimulator/libRestKit.a(lcl.o)   重复符号_lcl_configure_by_header in:       /Users/reserveout/Desktop/ReserveOutApplication/Build/Intermediates/ReserveOutApplication.build/Debug-iphonesimulator/ReserveOutApplication.build/Objects-normal/i386/lcl.o       /Users/reserveout/Desktop/ReserveOutApplication/Build/Products/Debug-iphonesimulator/libRestKit.a(lcl.o)   重复符号__lcl_component_header in:       /Users/reserveout/Desktop/ReserveOutApplication/Build/Intermediates/ReserveOutApplication.build/Debug-iphonesimulator/ReserveOutApplication.build/Objects-normal/i386/lcl.o       /Users/reserveout/Desktop/ReserveOutApplication/Build/Products/Debug-iphonesimulator/libRestKit.a(lcl.o)   重复符号_lcl_configure_by_name in:       /Users/reserveout/Desktop/ReserveOutApplication/Build/Intermediates/ReserveOutApplication.build/Debug-iphonesimulator/ReserveOutApplication.build/Objects-normal/i386/lcl.o       /Users/reserveout/Desktop/ReserveOutApplication/Build/Products/Debug-iphonesimulator/libRestKit.a(lcl.o)   重复符号__lcl_component_name:       /Users/reserveout/Desktop/ReserveOutApplication/Build/Intermediates/ReserveOutApplication.build/Debug-iphonesimulator/ReserveOutApplication.build/Objects-normal/i386/lcl.o       /Users/reserveout/Desktop/ReserveOutApplication/Build/Products/Debug-iphonesimulator/libRestKit.a(lcl.o)   重复符号__lcl_level_header in:       /Users/reserveout/Desktop/ReserveOutApplication/Build/Intermediates/ReserveOutApplication.build/Debug-iphonesimulator/ReserveOutApplication.build/Objects-normal/i386/lcl.o       /Users/reserveout/Desktop/ReserveOutApplication/Build/Products/Debug-iphonesimulator/libRestKit.a(lcl.o)   重复符号__lcl_level_header_1:       /Users/reserveout/Desktop/ReserveOutApplication/Build/Intermediates/ReserveOutApplication.build/Debug-iphonesimulator/ReserveOutApplication.build/Objects-normal/i386/lcl.o       /Users/reserveout/Desktop/ReserveOutApplication/Build/Products/Debug-iphonesimulator/libRestKit.a(lcl.o)   重复符号__lcl_level_header_3 in:       /Users/reserveout/Desktop/ReserveOutApplication/Build/Intermediates/ReserveOutApplication.build/Debug-iphonesimulator/ReserveOutApplication.build/Objects-normal/i386/lcl.o       /Users/reserveout/Desktop/ReserveOutApplication/Build/Products/Debug-iphonesimulator/libRestKit.a(lcl.o)   重复符号__lcl_level_name:       /Users/reserveout/Desktop/ReserveOutApplication/Build/Intermediates/ReserveOutApplication.build/Debug-iphonesimulator/ReserveOutApplication.build/Objects-normal/i386/lcl.o       /Users/reserveout/Desktop/ReserveOutApplication/Build/Products/Debug-iphonesimulator/libRestKit.a(lcl.o)   重复符号__lcl_version:       /Users/reserveout/Desktop/ReserveOutApplication/Build/Intermediates/ReserveOutApplication.build/Debug-iphonesimulator/ReserveOutApplication.build/Objects-normal/i386/lcl.o       /Users/reserveout/Desktop/ReserveOutApplication/Build/Products/Debug-iphonesimulator/libRestKit.a(lcl.o)   ld:19个架构i386的重复符号   clang:错误:链接器命令失败,退出代码为1(使用-v查看调用)

1 个答案:

答案 0 :(得分:0)

  1. 默认情况下,RestKit配置为使用JSONKit
  2. 导入错误,导致您无法导入。
  3. 尝试这个,但这是Wile E. Coyote的解决方案

    #import "RestKit/Code/Support/Parsers/JSON/RKJSONParserJSONKit.h"  
    

    3。如果您确实要复制资源,请仅复制头文件,而不是源(.m)