Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error with iOS 5.1 when i use ASIHTTPRequest and SBJSON

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?

like image 271
Vacca Avatar asked Apr 09 '12 12:04

Vacca


3 Answers

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).

like image 174
jmstone617 Avatar answered Oct 15 '22 14:10

jmstone617


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.

like image 4
iSaalis Avatar answered Oct 15 '22 16:10

iSaalis


i had this same problem , but when i included the following frame-work enter image description here

its working fine now..Don't forget to include -fno-objc-arc in the compile sourceenter image description here

Best Wishes.......

like image 3
Priyan Haridas Avatar answered Oct 15 '22 16:10

Priyan Haridas