stuck on current location - iphone sdk - iphone

I'm trying to get the current location using the iphone sdk. Here is the code:
http://pastie.org/572062
here is the error on build:
Building target “Send2iPhone” of project “Send2iPhone” with configuration “Release” — (2 errors)
cd /Users/pswenson/dev/send2iphone/iphone_code/Send2iPhone
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.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk -L/Users/pswenson/dev/send2iphone/iphone_code/Send2iPhone/build/Release-iphonesimulator -F/Users/pswenson/dev/send2iphone/iphone_code/Send2iPhone/build/Release-iphonesimulator -filelist /Users/pswenson/dev/send2iphone/iphone_code/Send2iPhone/build/Send2iPhone.build/Release-iphonesimulator/Send2iPhone.build/Objects-normal/i386/Send2iPhone.LinkFileList -mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework CoreGraphics -o /Users/pswenson/dev/send2iphone/iphone_code/Send2iPhone/build/Release-iphonesimulator/Send2iPhone.app/Send2iPhone
Undefined symbols:
".objc_class_name_CLLocationManager", referenced from:
literal-pointer#__OBJC#__cls_refs#CLLocationManager in DetailViewController.o
"_kCLLocationAccuracyNearestTenMeters", referenced from:
_kCLLocationAccuracyNearestTenMeters$non_lazy_ptr in DetailViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
".objc_class_name_CLLocationManager", referenced from:
literal-pointer#__OBJC#__cls_refs#CLLocationManager in DetailViewController.o
"_kCLLocationAccuracyNearestTenMeters", referenced from:
_kCLLocationAccuracyNearestTenMeters$non_lazy_ptr in DetailViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Build failed (2 errors)
I'm clueless.... any ideas?

Have you added the CoreLocation library to your project? Looks like your having problems linking, which usually means you don't have all the libraries your project needs.

Related

Obj-class-ref error when compiling for an iPhone

Ld /Users/rajeshmedampudi/Library/Developer/Xcode/DerivedData/sampleResource-flngddqnaawregcrrshzpianssjc/Build/Products/Debug-iphonesimulator/sampleResource.app/sampleResource normal i386
cd /Users/rajeshmedampudi/Dropbox/Work/iphone/sampleResource
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk -L/Users/rajeshmedampudi/Library/Developer/Xcode/DerivedData/sampleResource-flngddqnaawregcrrshzpianssjc/Build/Products/Debug-iphonesimulator -F/Users/rajeshmedampudi/Library/Developer/Xcode/DerivedData/sampleResource-flngddqnaawregcrrshzpianssjc/Build/Products/Debug-iphonesimulator -filelist /Users/rajeshmedampudi/Library/Developer/Xcode/DerivedData/sampleResource-flngddqnaawregcrrshzpianssjc/Build/Intermediates/sampleResource.build/Debug-iphonesimulator/sampleResource.build/Objects-normal/i386/sampleResource.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50100 -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/rajeshmedampudi/Library/Developer/Xcode/DerivedData/sampleResource-flngddqnaawregcrrshzpianssjc/Build/Products/Debug-iphonesimulator/sampleResource.app/sampleResource
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_User", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_AuthenticationViewController", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_AppHelpers", 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)
this is the error I am getting when I try to run the file ... I have imported those classes from another project into this one which was non arc based and converted to ARC. I got this error after successfully removing all the references to autorelease and retains from it.
Did you try Product->Clean?
Or restarting XCode?
Did you make sure you've included everything in the Targets->Build Phases->Compile Sources? Xcode does this for you, but sometimes it misses things.

"_OBJC_CLASS_$_KalViewController", referenced from

Can any one tell me the meaning of this error ,
this is the details of the error log :
Ld build/Debug-iphonesimulator/Holiday.app/Holiday normal i386
cd /Users/Ahmed/Desktop/klazuka-Kal-b2e164c/Examples/Holiday
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/Ahmed/Desktop/klazuka-Kal-b2e164c/Examples/Holiday/build/Debug-iphonesimulator -F/Users/Ahmed/Desktop/klazuka-Kal-b2e164c/Examples/Holiday/build/Debug-iphonesimulator -filelist /Users/Ahmed/Desktop/klazuka-Kal-b2e164c/Examples/Holiday/build/Holiday.build/Debug-iphonesimulator/Holiday.build/Objects-normal/i386/Holiday.LinkFileList -mmacosx-version-min=10.6 -all_load -Xlinker -objc_abi_version -Xlinker 2 -framework Foundation -framework UIKit -framework CoreGraphics /Users/Ahmed/Desktop/klazuka-Kal-b2e164c/src/build/Debug-iphoneos/libKal.a -lsqlite3 -o /Users/Ahmed/Desktop/klazuka-Kal-b2e164c/Examples/Holiday/build/Debug-iphonesimulator/Holiday.app/Holiday
ld: warning: in /Users/Ahmed/Desktop/klazuka-Kal-b2e164c/src/build/Debug-iphoneos/libKal.a, missing required architecture i386 in file
Undefined symbols:
"_OBJC_CLASS_$_KalViewController", referenced from:
objc-class-ref-to-KalViewController in HolidayAppDelegate.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
It's a linker error, ensure that KalViewController is added to the current target, choose Get Info on it and go to the targets tab, ensure that the box is ticked.
In the Kal project's settings, make sure that it is compiled for the i386 architecture.

GameKit / GameCenter - I386

I'm having some hard time with the iOS GameCenter
I'm following some tutorials on youtube
but as soon as I finish the code I get this error:
Ld /Users/fgringo/Library/Developer/Xcode/DerivedData/Game-Center-Test-aggpqkxrazgvnseohuityqvchrnm/Build/Products/Debug-iphonesimulator/Game-Center-Test.app/Game-Center-Test normal i386
cd /Users/fgringo/Documents/DEVELOPER/Game-Center-Test
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/fgringo/Library/Developer/Xcode/DerivedData/Game-Center-Test-aggpqkxrazgvnseohuityqvchrnm/Build/Products/Debug-iphonesimulator -F/Users/fgringo/Library/Developer/Xcode/DerivedData/Game-Center-Test-aggpqkxrazgvnseohuityqvchrnm/Build/Products/Debug-iphonesimulator -F/Users/fgringo/Documents/DEVELOPER/Game-Center-Test -filelist /Users/fgringo/Library/Developer/Xcode/DerivedData/Game-Center-Test-aggpqkxrazgvnseohuityqvchrnm/Build/Intermediates/Game-Center-Test.build/Debug-iphonesimulator/Game-Center-Test.build/Objects-normal/i386/Game-Center-Test.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -framework UIKit -framework Foundation -framework CoreGraphics -framework GameKit -framework MediaPlayer -o /Users/fgringo/Library/Developer/Xcode/DerivedData/Game-Center-Test-aggpqkxrazgvnseohuityqvchrnm/Build/Products/Debug-iphonesimulator/Game-Center-Test.app/Game-Center-Test
ld: warning: ignoring file /Users/fgringo/Documents/DEVELOPER/Game-Center-Test/GameKit.framework/GameKit, missing required architecture i386 in file
ld: warning: ignoring file /Users/fgringo/Documents/DEVELOPER/Game-Center-Test/MediaPlayer.framework/MediaPlayer, missing required architecture i386 in file
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_GKLocalPlayer", referenced from:
objc-class-ref in GameCenterManager.o
"_OBJC_CLASS_$_GKLeaderboard", referenced from:
objc-class-ref in GameCenterManager.o
"_OBJC_CLASS_$_GKScore", referenced from:
objc-class-ref in GameCenterManager.o
"_OBJC_CLASS_$_GKAchievement", referenced from:
objc-class-ref in GameCenterManager.o
"_OBJC_CLASS_$_GKPlayer", referenced from:
objc-class-ref in GameCenterManager.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
It looks like you haven't added the GameKit framework to your project.
If your using Xcode 3.2.x:
Right click the Frameworks group/folder in the file tree (on the left of the xcode window)
Press Add, and then select Existing Frameworks...
Scroll to GameKit.framework and double click it
If your using Xcode 4:
In the file tree, click on the project (the item at the top)
Select your target
Go to the Build Phases tab on the main panel
Expand the Link Binary with Libraries
Press the + button
Scroll to the GameKit.framework and double click it.
Did you add the GameKit.framework to your project?

compile error on Xcode

How can i fix it
Ld build/Debug-iphonesimulator/iRadio.app/iRadio normal i386
cd /Users/ragopor/Desktop/iRadio
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.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.2.sdk -L/Users/ragopor/Desktop/iRadio/build/Debug-iphonesimulator -F/Users/ragopor/Desktop/iRadio/build/Debug-iphonesimulator -F/Users/ragopor/Desktop/iRadio -filelist /Users/ragopor/Desktop/iRadio/build/iRadio.build/Debug-iphonesimulator/iRadio.build/Objects-normal/i386/iRadio.LinkFileList -mmacosx-version-min=10.5 -framework MediaPlayer -framework Foundation -framework UIKit -framework CoreGraphics -o /Users/ragopor/Desktop/iRadio/build/Debug-iphonesimulator/iRadio.app/iRadio
ld: warning: in /Users/ragopor/Desktop/iRadio/MediaPlayer.framework/MediaPlayer, missing required architecture i386 in file
Undefined symbols:
".objc_class_name_MPMoviePlayerController", referenced from:
literal-pointer#__OBJC#__cls_refs#MPMoviePlayerController in iRadioAppDelegate.o
"_MPMoviePlayerContentPreloadDidFinishNotification", referenced from:
_MPMoviePlayerContentPreloadDidFinishNotification$non_lazy_ptr in iRadioAppDelegate.o
"_MPMoviePlayerScalingModeDidChangeNotification", referenced from:
_MPMoviePlayerScalingModeDidChangeNotification$non_lazy_ptr in iRadioAppDelegate.o
"_MPMoviePlayerPlaybackDidFinishNotification", referenced from:
_MPMoviePlayerPlaybackDidFinishNotification$non_lazy_ptr in iRadioAppDelegate.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Looks like you need to include the MediaFramework in your project.
I had the same issue while all frameworks and compiling sources were added. What fixed my issue was to delete ~/ProjectFolder/MediaPlayer.framework/MediaPlayer.exec file, and then build and run, and it worked!

Linker error when trying to use MPMoviePlayer

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.