Undefined symbols for architecture i386 “_OBJC_CLA

2019-02-05 02:38发布

问题:

After adding Appirater to my iOS project, when I compile, I get the error:

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

After searching and searching on the internet, none of the solutions found helped.

Both my project and target are setup as:

What should I try more?

回答1:

I think, that you only added files to project, but not to target.
Click on Appirater.m file in Project Navigator and set checkbox near to your target name in Target membership of File Inspector.



回答2:

It seems that you haven't properly added the Appirater code to your project. Both Appirater.h and Appirater.m must be part of your project, and Appirater.m must be compiled like all your other files.



回答3:

You'll also get this error if you've neglected to add the CFNetwork and SystemConfiguration frameworks to your project.



回答4:

I just had the same problem, and fixed it.

The cause of my issue is I had dragged and dropped a file from other project to the current.

Of course it is working when we remove and recreate the file.