I made a new xcdatamodeld with 2 entities
stage, this one has a relationship many to level
level, this one has many attributes and one relationship with stage
but when I create NSManagedObject subclass from that xcdatamodeld, and build my project.. 3 errors are shown in the log
like this:
Undefined symbols for architecture i386:
"_OBJC_METACLASS_$_NSManagedObject", referenced from:
_OBJC_METACLASS_$_Stage in Stage.o
_OBJC_METACLASS_$_Level in Level.o
"_OBJC_CLASS_$_NSManagedObject", referenced from:
_OBJC_CLASS_$_Stage in Stage.o
_OBJC_CLASS_$_Level in Level.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
anyone has had this trouble too?
How can I fix this error?
I am newbie at xcode and IOS programmer, thank you in advance ^^
It seems you haven't added CoreData.framework in your project. For this - Select Target Go to Build Phases > Link Binary With Libraries then Click on '+' button (At below left corner), Then select the CoreData.framework then click on ADD button.
Related
I downloaded a collection of private libraries from this link. When I click download I get all frameworks. So these are only header files not the .framework files that are available in Xcode. So I linked them by the usual method of going to build phases, in it I go to link binary with libraries click on + and choose the header files from a framework (preferences framework in my case). After these files are added to my project I try to make an object from one of the libraries and try to call their instance methods. When I try to execute this program I get this error. I get this whether I run it on the device or simulator.
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_DevicePINController", referenced from:
objc-class-ref in UAViewController.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1
(use -v to see invocation)
DevicePinController is a part of a private framework preferences.h.I am trying to make an object of it UA
EDIT: I tried using other framework headers such as bluetooth and I get this error in all.
EDIT: I tried adding the entire framework to the project instead of adding individual header files.Now the error is
d: framework not found BluetoothManager
clang: error: linker command failed with exit code 1 (use -v to see invocation)
You'll need to actually build the framework. You can't just link against a header file; that doesn't make sense.
Try adding all the .m files in the Preferences folder as Compile Sources, and remove the header file from Link Binary with Libraries.
Added: I realize now this answer is incorrect. The files OP is trying to use are not a library, but header files from Apple's private frameworks. Here's a related answer: https://stackoverflow.com/a/13388225/893113
I am trying to set up application tests for my iOS application. I am using the following article as the basis of what I am doing:
http://cocoawithlove.com/2009/12/sample-iphone-application-with-complete.html
So I can created the additional targets that I need. I now have 3 targets:
-The original target
-The tests target
-The duplicate target
I have added the original target as a target dependency to my test target. I have then added the test target as a target dependency on my duplicate target.
However, whenever I try to reference any of my classes in my test cases I get:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_MyClass", referenced from:
objc-class-ref in MyApplicationTests.o
"_OBJC_CLASS_$_AnotherClass", referenced from:
objc-class-ref in MyApplicationTests.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Is there another location which I need to set up some sort of dependency to tell my Tests target that it is dependant on the original target?
Cheers
So I found the solution to this issue at:
http://twobitlabs.com/2011/06/adding-ocunit-to-an-existing-ios-project-with-xcode-4/
You need to do the following to avoid this issue:
Go back to your app target (not the test target), set the Symbols Hidden by Default build setting to NO
Now there is no need to add any source files to the Compile Source for the test target as long as the original target is set as a dependency.
You have to include the .m file for any of your classes that you reference from your test code in the list of compiled sources for your test target. From the error message you provided, that sounds like your problem. In XCode 4.2 you can add a compile source to a target by selecting your project in the project navigator, then selecting your test target, the Build Phases tab, and expanding the Compile Sources section. Click the "+" below the Compile Sources section and then select your class' .m file.
I have added the SystemConfiguration framework. I am deploying against targets from 3.2 and higher. Have I forgotten to add something?
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_Reachability", 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)
Okay, the clues are all in the error report you have posted.
While linking (the message is from the linker ld) which occurs after compilation of all the symbols across your project, the message is saying
"In AppDelegate, you have referenced a class object called Reachability"
"_OBJC_CLASS_$_Reachability"
and as far as the linker is concerned Reachability is undefined.
So, check that Reachability is being compiled in your project. The are a couple of ways to do this. Perhaps the most clear way is to
1 select the project file in the navigation pane
2 select the target
3 select Build Phases
4 Expand the Compile Sources section
*Now check the list of sources that will be compiled for your missing class, in your case Reachability.m
If it is missing, use the + button to add the file to the target.
Another way is to
1 select the file you think is not being compiled
2 open the utilities panel
3 select the file inspector tab
There will be a checkbox for each target in your project and you can easily see if your .m file is being compiled for each/all targets or not.
You might have forgotten to include the Reachability classes in your project!
I had a similar problem when I upgraded to the newest version of Mixpanel. The error read:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CTTelephonyNetworkInfo", referenced from:
objc-class-ref in Mixpanel.o
You can follow Damo's solution until the last step, and then instead of expanding the Compile Sources section, you have to expand the Link Binary With Libraries section instead, and add the CoreTelephony.framework source which contains CTTelephonyNetworkInfo.
You can read more about the CTTelephonyNetworkInfo class reference on Apple's official website here: http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Reference/CTTelephonyNetworkInfo/Reference/Reference.html
I'm trying to use SHFHKeychainUtils in my project, but I keep getting the following error when I build:
".objc_class_name_SFHFKeychainUtils", referenced from:
literal-pointer#__OBJC#__cls_refs#SFHFKeychainUtils in ResultsViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
I added Security.framework via Target > Get Info > General
Any help would be greatly appreciated, thanks.
It's because you haven't added the files SFHFKeychainUtils (.h and .m) to your project, or that they aren't included for your target (check this by making sure the check-box at the right of the line for this file is checked).
I am getting the following error when compiling my code
"_CGRectZero", referenced from:
_CGRectZero$non_lazy_ptr in RootViewController.o
_CGRectZero$non_lazy_ptr in SecondViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Build failed (1 error)
could someone tell me a solution to solve this?
Sounds like your project is missing a framework.
Right-click on the Frameworks folder in your project's Groups & Files column, then select Add > Existing Frameworks...
Choose CoreGraphics.framework from the frameworks list.
Once you rebuild, this error should go away (unless it is something else).