iOS5中的Json显示错误

时间:2011-12-21 04:16:53

标签: ios json compiler-errors

"_OBJC_CLASS_$_SBJSON", referenced from:

Objc-class-ref in JparseViewController.o

Symbol(s) not found for architecture i386

Clang: error: linker command failed with exit code 1 (use -v to see invocation)

Ld /Users/mag1/Library/Developer/Xcode/DerivedData/Jparse-heknsvlbknssribatbwgkuefjoja/Build/Products/Debug-iphonesimulator/Jparse.app/Jparse_armv7 armv7 i386
    cd "/Users/mag1/Documents/Xcode Projects/Jparse"
    setenv MACOSX_DEPLOYMENT_TARGET 10.6
    setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/mag1/Library/Developer/Xcode/DerivedData/Jparse-heknsvlbknssribatbwgkuefjoja/Build/Products/Debug-iphonesimulator -F/Users/mag1/Library/Developer/Xcode/DerivedData/Jparse-heknsvlbknssribatbwgkuefjoja/Build/Products/Debug-iphonesimulator -filelist /Users/mag1/Library/Developer/Xcode/DerivedData/Jparse-heknsvlbknssribatbwgkuefjoja/Build/Intermediates/Jparse.build/Debug-iphonesimulator/Jparse.build/Objects-armv7/i386/Jparse.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/mag1/Library/Developer/Xcode/DerivedData/Jparse-heknsvlbknssribatbwgkuefjoja/Build/Products/Debug-iphonesimulator/Jparse.app/Jparse_armv7

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

我从下载的示例中获取了JSON框架文件。这些示例工作正常,但我的项目显示上述错误。

3 个答案:

答案 0 :(得分:2)

Symbol(s) not found for architecture i386

以下情况发生以上错误:

  1. 您试图在iPhone / iPad模拟器中运行您的应用程序
  2. 该库仅构建为在物理设备上运行,并且不支持在模拟器中运行。
  3. 要解决此问题,您需要将i386添加到SBJSON库构建目标的有效体系结构中,或使用物理设备测试应用程序。

答案 1 :(得分:2)

您没有将SBJSON.m文件添加到目标。检查此文件的属性面板,并且应该有一个复选框,指示分配给它的目标。您可能根本忘记将SBJSON.m复制到您的项目中。

答案 2 :(得分:2)

转到 Projectapp - > Buildphases - > compileSources

这里添加带有+图标的JSON的所有.m文件。问题将得到解决