Error with iOS 5.1 when i use ASIHTTPRequest and SBJSON

﹥>﹥吖頭↗ 提交于 2019-12-07 04:48:18

问题


i am getting this error:

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

Note i have added the frameworks core graphics,system configuration,mobile core services,libz.dylib,libz.1.2.5.dylib,CF Network,UI Kit and Foundation. I have searched all the forums and spend almost 4 days but just don't find the cause.

When i comment my ASIHTTPRequest and SBJSON code lines,it works fine. I have added all the classes for ASIHTTPRequest and SBJSON and checked thrice. Could anyone suggest what am i doing wrong?


回答1:


I would take a look at the Build Phases section in your Target. Under "Compile Sources", make sure you see the .m files for ASIHTTPRequest and for SBJson. Sometimes when you drag external classes into a project, even if you check the box to copy the files into your project, they don't make it into these compile sources. When you drag a file into Xcode, there is a check box to add the file to the target. If this isn't checked, the file won't make it into the Compile Sources. Delete the files and re-add them, ensuring this file is checked (or you can add the .m files manually if you'd like).




回答2:


For ASIHTTP Request add the following frameworks:

  • libz.1.2.5.dylib
  • SystemConfiguration
  • UIKit
  • Foundation
  • CoreGraphics
  • MobileCoreServices
  • CFNetworks

If you are using ASIHttp classes in iOS 5 or later, you need to turn ARC off for the ASIHttpRequest classes in Project-> Build Phases -> Compile Sources by using -fno-objc-arc for the ASI API classes.

Hope it solves the problem.




回答3:


i had this same problem , but when i included the following frame-work

its working fine now..Don't forget to include -fno-objc-arc in the compile source

Best Wishes.......




回答4:


For the ASIHTTPRequest error, it sounds like you've not added ASIHTTPRequest.m to your project.

(Or you have added ASIHTTPRequest.m, but have forgotten to mention the 4 billion errors xcode is emitting about ARC - see Why are my ASIHTTPRequest files showing ARC errors? )



来源:https://stackoverflow.com/questions/10073273/error-with-ios-5-1-when-i-use-asihttprequest-and-sbjson

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!