I was doing the Apple Core Data Tutorial, and on the first occasion I was suggested to build the project, I got this error:
Ld /Users/user/Library/Developer/Xcode/DerivedData/Locations-fajvunxiruohofbhzimrgekrpnqh/Build/Products/Debug-iphonesimulator/Locations.app/Locations normal i386
cd "/Users/user/Documents/xcode projects/Locations"
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/llvm-gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -L/Users/user/Library/Developer/Xcode/DerivedData/Locations-fajvunxiruohofbhzimrgekrpnqh/Build/Products/Debug-iphonesimulator -F/Users/user/Library/Developer/Xcode/DerivedData/Locations-fajvunxiruohofbhzimrgekrpnqh/Build/Products/Debug-iphonesimulator -filelist /Users/user/Library/Developer/Xcode/DerivedData/Locations-fajvunxiruohofbhzimrgekrpnqh/Build/Intermediates/Locations.build/Debug-iphonesimulator/Locations.build/Objects-normal/i386/Locations.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -framework UIKit -framework Foundation -framework CoreGraphics -framework CoreData -o /Users/user/Library/Developer/Xcode/DerivedData/Locations-fajvunxiruohofbhzimrgekrpnqh/Build/Products/Debug-iphonesimulator/Locations.app/Locations
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CLLocationManager", referenced from:
objc-class-ref in RootViewController.o
"_kCLLocationAccuracyNearestTenMeters", referenced from:
-[RootViewController locationManager] in RootViewController.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
I use XCode 4.0.2, Mac OS X 10.6.8. What can be the cause of this? I followed the tutorial step-by-step and have absolutely no idea what could go wrong.
You need to import the CoreLocation framework. This can be done by going to the Project - Build Phases - Link Binary with Libraries
Looks like you need to add the CoreLocation framework to the linked frameworks of the project.
In the project settings, select the application target and under "Build Phases" add it to the "Link Binary With Libraries" step.
When you started the project did you select "Use Core Data For Storage"? I think it adds a framework you need.
click on your project in the navigation pane (apple + 1)
targets -> your project-> build phases -> link binaries with libraries -> +
then select CoreData.framework and add.
Sometimes the .m file is dropped out of the 'Compiled sources' list in XCode. You need to add the .m file manually:
Build phases > Compiled sources > (check for if your .m file is indeed missing) > Add .m file > Build
Related
I'm trying to use Objective-Zip on an IOS5 iPhone application and I get the following linkage error when I build my project:
----------- ***********---------------
Ld /Users/amirpeivandi/Library/Developer/Xcode/DerivedData/Zarvaragh-czcfescrnmgrljfojncagweywohi/Build/Products/Debug-iphonesimulator/Zarvaragh.app/Zarvaragh normal i386
cd /Users/amirpeivandi/Documents/iPhoenApps/Zarvaragh
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/amirpeivandi/Library/Developer/Xcode/DerivedData/Zarvaragh-czcfescrnmgrljfojncagweywohi/Build/Products/Debug-iphonesimulator -F/Users/amirpeivandi/Library/Developer/Xcode/DerivedData/Zarvaragh-czcfescrnmgrljfojncagweywohi/Build/Products/Debug-iphonesimulator -filelist /Users/amirpeivandi/Library/Developer/Xcode/DerivedData/Zarvaragh-czcfescrnmgrljfojncagweywohi/Build/Intermediates/Zarvaragh.build/Debug-iphonesimulator/Zarvaragh.build/Objects-normal/i386/Zarvaragh.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=40300 -lz -framework CoreGraphics -framework MobileCoreServices -framework SystemConfiguration -framework CFNetwork -framework UIKit -framework Foundation -o /Users/amirpeivandi/Library/Developer/Xcode/DerivedData/Zarvaragh-czcfescrnmgrljfojncagweywohi/Build/Products/Debug-iphonesimulator/Zarvaragh.app/Zarvaragh
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_ZipFile", referenced from:
objc-class-ref in MainPageController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
----------- ***********---------------
I have no problem running the Objective-Zip application that comes with the code and I have checked my code, my project settings and all I could think of and the two projects (mine and default Objective-Zip iPhone project) have the same identical settings!
Any pointer would be greatly appreciated. I've been stuck for last couple of days on this silly thing. I've seen a few posts pointing to architecture supports and ARC setting but again I have two projects the way I see them identical one mine that is not compiling and one the one from Objective-Zip project that compiles and runs just fine!
Thx
Amir
Are you sure you have linked the Objective-Zip library in your project ? Because from the error it seems like it's not linked.
I am trying to link HessianKit with a simple Xcode iOS test project.
I tried different build configurations.
I added the -ObjC switch to both the linker command line for the library project and for my main project.
This is the command line from the main project:
Ld /Users/wuttke/Library/Developer/Xcode/DerivedData/MatthiasSimpleTest-gfekzjmarzscwwgbynkuztivwkpw/Build/Products/Debug-iphonesimulator/MatthiasSimpleTest.app/MatthiasSimpleTest normal i386
cd /Users/wuttke/Documents/MatthiasSimpleTest
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/wuttke/Library/Developer/Xcode/DerivedData/MatthiasSimpleTest-gfekzjmarzscwwgbynkuztivwkpw/Build/Products/Debug-iphonesimulator -L/Users/wuttke/Documents/MatthiasSimpleTest/MatthiasSimpleTest -L/Users/wuttke/Documents/MatthiasSimpleTest -F/Users/wuttke/Library/Developer/Xcode/DerivedData/MatthiasSimpleTest-gfekzjmarzscwwgbynkuztivwkpw/Build/Products/Debug-iphonesimulator -F/Users/wuttke/Documents/MatthiasSimpleTest -filelist /Users/wuttke/Library/Developer/Xcode/DerivedData/MatthiasSimpleTest-gfekzjmarzscwwgbynkuztivwkpw/Build/Intermediates/MatthiasSimpleTest.build/Debug-iphonesimulator/MatthiasSimpleTest.build/Objects-normal/i386/MatthiasSimpleTest.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 -framework HessianKit -o /Users/wuttke/Library/Developer/Xcode/DerivedData/MatthiasSimpleTest-gfekzjmarzscwwgbynkuztivwkpw/Build/Products/Debug-iphonesimulator/MatthiasSimpleTest.app/MatthiasSimpleTest
This the error message from the linker:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CWHessianConnection", referenced from:
objc-class-ref in MainWindowController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I attached a screenshot showing the project (it contains the HessianKit.framework, we build for i386/MacOS, iOS 5.0).
This is some output showing the contents of the library to be linked:
Tobiass-MacBook-Pro:HessianKit.framework wuttke$ pwd
/Users/wuttke/Documents/MatthiasSimpleTest/HessianKit.framework
Tobiass-MacBook-Pro:HessianKit.framework wuttke$ ls
Headers HessianKit Resources Versions
Tobiass-MacBook-Pro:HessianKit.framework wuttke$ nm -arch i386 HessianKit | grep CWHessianConnection
000010a0 t +[CWHessianConnection proxyWithURL:protocol:]
00001020 t -[CWHessianConnection initWithHessianVersion:]
000011a0 t -[CWHessianConnection proxyWithURL:protocol:]
00001260 t -[CWHessianConnection setVersion:]
00001240 t -[CWHessianConnection version]
0000d000 S .objc_class_name_CWHessianConnection
I found the suggestion to try to include the HessianKit files directly with the project. This gives compile errors because of the ARC.
Have you got any suggestions I could try? Thanks a lot in advance.
Matthias
I am very new to Xcode and was able to solve this issue. I was trying to use HessianKit in a project I'm developing.
The solution to the problem is described in this post: https://stackoverflow.com/a/7866167/1366367
Apparently the iPhone simulator requires libraries to built for the i386 architecture not armv7.
This worked for me:
Open Project HessianKit (downloaded from sourceforge)
Set Base SDK on HessianKit target to iphonesimulator
Clear Base SDK for StaticHessianKit target (should default to iphonesimulator)
Run Build
Find libStaticHessianKit.a in ~/Library/Developer/Xcode/DerivedData/*/Build/Products/Debug-iphonesimulator folder
Drag libStaticHessianKit.a into your project. This should automatically set up library search paths.
Drag HessianKit framework folder to your project as well.
Make sure you import this where you are using HessianKit:
#import <HessianKit/HessianKit.h>
Good luck.
Being new to iPhone development I was wanting to take it to the next level and use the Three20 library for a photo gallery I am building.
http://www.raywenderlich.com/1430/how-to-use-the-three20-photo-viewer
Everything seemed to go smoothly up to the point I tried testing the app and I got this error.
"_OBJC_METACLASS_$_TTURLRequestModel", referenced from:
Ld build/Debug-iphonesimulator/PhotoGallery.app/PhotoGallery normal i386
cd /Users/company/Documents/PhotoGallery
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/gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk -L/Users/company/Documents/PhotoGallery/build/Debug-iphonesimulator -F/Users/company/Documents/PhotoGallery/build/Debug-iphonesimulator -filelist /Users/company/Documents/PhotoGallery/build/PhotoGallery.build/Debug-iphonesimulator/PhotoGallery.build/Objects-normal/i386/PhotoGallery.LinkFileList -mmacosx-version-min=10.6 -ObjC -all_load -Xlinker -objc_abi_version -Xlinker 2 -framework Foundation -framework UIKit -framework CoreGraphics -framework CFNetwork -framework SystemConfiguration -framework MobileCoreServices -lz.1.2.3 -framework CoreLocation -framework QuartzCore /Users/company/Documents/opensource/three20/Build/Products/Debug-iphonesimulator/libThree20.a -framework CoreData -o /Users/company/Documents/PhotoGallery/build/Debug-iphonesimulator/PhotoGallery.app/PhotoGallery
Undefined symbols:
"_OBJC_METACLASS_$_TTURLRequestModel", referenced from:
_OBJC_METACLASS_$_PhotoSet in PhotoSet.o
"_OBJC_CLASS_$_TTURLRequestModel", referenced from:
_OBJC_CLASS_$_PhotoSet in PhotoSet.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Anyone
While I included the Three20 static library I didn't include the other dependencies in the same library such as Three20UINavigator.xcodeproj etc.
Sudo was pretty close. While I did include the proper libraries it was simply that they were not activated; I don't know the proper term :P
Basically, we should keep in mind that just because I dragged the Three20.xcodeproj into my project doesn't suffice when other extensions are needed as well. Simply drag all of the xcodeproj files necessary in (wherever you are keeping three20)/three20/src/(name of particular extension)/(name of particular file).xcodeproj into your projects "group and files" Then click on each extension and select the (name of particular file).a and check the checkbox on the far right of the file preview section. This is what I didn't do for all the extensions that seemed to resolve the problem even though I had previously included them all.
I'm trying to use GDataXML library in my ipad application. I followed by instructions:
Download the gdata-objective-c client library.
Unzip the file, navigate to Source\XMLSupport, and drag the two files GDataXMLNode.h and GDataXMLNode.m into your project
In XCode, click Project\Edit Project Settings and make sure “All Configurations” are checked.
Find the Search Paths\Header Search Paths setting and add /usr/include/libxml2 to the list.
Finally, find the Linking\Other Linker Flags section and add -lxml2 to the list.
If in code i add #import "GDataXMLNode.h", all is fine. But when i try to use GDataXMLDocument class in my app
GDataXMLDocument *doc = [[GDataXMLDocument alloc] initWithData:xmlData options:0 error:nil];
I received the following message:
Ld build/Debug-iphonesimulator/DemoApp.app/DemoApp normal i386
cd /Users/svp/Projects/DemoApp
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/gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk -L/Users/svp/Projects/DemoApp/build/Debug-iphonesimulator -F/Users/svp/Projects/DemoApp/build/Debug-iphonesimulator -filelist /Users/svp/Projects/DemoApp/build/DemoApp.build/Debug-iphonesimulator/DemoApp.build/Objects-normal/i386/DemoApp.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -framework Foundation -framework UIKit -framework CoreGraphics -framework MapKit -framework QuartzCore -lxml2.2 -o /Users/svp/Projects/DemoApp/build/Debug-iphonesimulator/DemoApp.app/DemoApp
Undefined symbols:
"_OBJC_CLASS_$_GDataXMLDocument", referenced from:
objc-class-ref-to-GDataXMLDocument in TwitterService.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Any thoughts?
It sounds like the GDataXMLNode.m code isn't being linked in. Is that source file really added to the target being built in Xcode?
Best thing is to leave the source code untouched and tell your project not to apply the ARC mechanism to this file.
To do so:
1- Select the build phases of your projet
2- Select the GDataXMLNode.m file
3- Add the switch: -fno-objc-arc to this file alone (by double clicking on it)
Bingo!
Hope it helps.
Check the following:
Have you copied the file into your project or just passed the reference of the file.
If you have not copied the file into your project (just passed the reference to it by drag drop or other ways), make sure that the path in "Header search Paths" is properly updated.
Its seems like you have missed to update the path from where you are referencing the file.
On a fresh install of Xcode 3.1.2, I'm trying to use the iPhone MoviePlayer as shown in the sample code at http://developer.apple.com/iphone/library/codinghowtos/AudioAndVideo/index.html#INITIATE_VIDEO_PLAYBACK_IN_MY_CODE
However, Xcode reports the following linker errors when I try to build-n-go:
Building target “EOY” of project “EOY” with configuration “Debug” — (2 errors)
cd /Users/ed/dev/EOY
setenv MACOSX_DEPLOYMENT_TARGET 10.5
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/gcc-4.0 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk -L/Users/ed/dev/EOY/build/Debug-iphonesimulator -F/Users/ed/dev/EOY/build/Debug-iphonesimulator -filelist /Users/ed/dev/EOY/build/EOY.build/Debug-iphonesimulator/EOY.build/Objects-normal/i386/EOY.LinkFileList -mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework CoreGraphics -o /Users/ed/dev/EOY/build/Debug-iphonesimulator/EOY.app/EOY
Undefined symbols:
".objc_class_name_MPMoviePlayerController", referenced from:
literal-pointer#__OBJC#__cls_refs#MPMoviePlayerController in MediaSupport.o
"_MPMoviePlayerPlaybackDidFinishNotification", referenced from:
_MPMoviePlayerPlaybackDidFinishNotification$non_lazy_ptr in MediaSupport.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
".objc_class_name_MPMoviePlayerController", referenced from:
literal-pointer#__OBJC#__cls_refs#MPMoviePlayerController in MediaSupport.o
"_MPMoviePlayerPlaybackDidFinishNotification", referenced from:
_MPMoviePlayerPlaybackDidFinishNotification$non_lazy_ptr in MediaSupport.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Build failed (2 errors)
that is right. Another way to do it is by adding the MediaPlayer to the Project Target by selecting TARGETS->Build Phases->Link Binary with Libraries (here add MediaPlayer)
Yes, if your code calls into a framework, you have to add that framework to your target and link against it.
Make sure the framework is "Relative to Current SDK" (select the framework > Get Info > General tab) so that when you build for the device, it links against the device's version, not the simulator's.
Found the problem. I haven't read all the docs, but there are a lot of them...
Anyway, I fixed this by dragging the directory
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk/System/Library/Frameworks/MediaPlayer.framework/
into the Frameworks folder in XCode and clicking OK on the import dialog.