Compiling reverse geocoding in iOS 5 - objective-c

I'm writing a program for iOS 5. The program should perform reverse geocoding.
When trying to compile I get the warning
MKReverseGeocoder is deprecated
and an error
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CLLocationManager", referenced from:
objc-class-ref in UserLocationAddressViewController.o"
I have 2 questions:
How can I compile without the warning and the error?
I want the application to run on iOS 3, iOS 4, and on iOS 5. How can I do it?

You need to make sure your deployment target is set to the lowest iOS version you want to support. In the example below, the app is built for 5.0 (base SDK), but will run on iOS 4.0 (deployment target):
Setting this to any value below 5.0 will remove the deprecation warning.

Related

iPhone 5.1 App using OpenCV crashes due to "nonatomic" not found

I'm developing an iOS App which targets iOS 5.1+. I'm using XCode 4.5 on Mac OS X 10.8 and I do own an iPhone 4 with iOS 5.1.1. The app needs OpenCV, which I have successfully built from sources according to a tutorial in the OpenCV-Documentation.
Here is what happens:
When I start up the application I get an exception:
dyld: Symbol not found: _objc_setProperty_nonatomic
The error does not occur with iOS 6, but with iOS 5.1 in both the simulator and on a real device.
What is that? Is it related to OpenCV? Does it have to do something with incompatibilities between iOS / the iPhone / XCode??
EDIT: My development target is set to 5.1. The Base SDK is 6.0. I copied an SDK für 4.3 (which is the lowest version that XCode 4.5 will support) from another Mac and set development target as well as the base SDK to 4.3. Did not work either (it did not even build then).
I did not an update, the project has been started from scratch using XCode 4.5 initially.
Meanwhile I also found a tip to use gnulibc++ instead of libc++, but that also resulted in that the project did not build at all.
I built a test project and found the same issue. OpenCV is being built with a deployment target of ios6, this is a known issue, and a fix is pending review, see https://github.com/Itseez/opencv/pull/70

Facebook iOS SDK 3.1 with XCode 4.2 linker errors

I've just updated the Facebook iOS SDK in my project from 3.0 to 3.1. The project does not compile anymore. Instead I get the following linker errors:
Undefined symbols for architecture i386:
"_ACFacebookAppIdKey", referenced from:
-[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
"_ACFacebookAudienceEveryone", referenced from:
-[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
"_ACFacebookAudienceFriends", referenced from:
-[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
"_ACFacebookAudienceKey", referenced from:
-[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
"_ACFacebookAudienceOnlyMe", referenced from:
-[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
"_ACFacebookPermissionsKey", referenced from:
-[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
"_OBJC_CLASS_$_ASIdentifierManager", referenced from:
objc-class-ref in FacebookSDK(FBSettings.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The Facebook docs clearly say:
The SDK relies on three other frameworks (AdSupport, Accounts and
Social) to use the Facebook features built into iOS6.
Those frameworks do not exist in Xcode 4.2 . Is there any workaround, i.e. can I download (where?) and add the frameworks manually to my project and will that suffice to get rid of the compile errors or do I have to upgrade to Xcode 4.5?
Those frameworks are part of iOS 6 (well, except for Accounts, which is from iOS 5). You won't be able to use them without upgrading to Xcode 4.5, and consequently, iOS 6 SDK.
You can still set your deployment target down to iOS 4.3, if that's your concern.
I think your options are:
Upgrade to Xcode 4.5, or
Use Facebook SDK 3.0.
To make things clear:
For XCode 4.5:
If you use FB SDK3.0, you only need to add Accounts and FacebookSDK frameworks.
If you use FB SDK3.1, you need to add Accounts, FacebookSDK, Social, and AdSupport frameworks.
If you use FB SDK3.2++, check by yourself what other frameworks you may or may not need. ;)
Hope that sums it up nicely for everyone.
The SDK relies on three other frameworks (AdSupport, Accounts and Social).
To add these, go to the 'Linked Frameworks and Libraries' section of the target's Summary pane, and add them.
Sobri is right. Either upgrade to Xcode 4.5 or use SDK 3.0 or If you want to use 3.1 then download the source from github, modify the build file(basically remove the references to frameworks provided by iOS 6.0 ) and rebuild the SDK. That ways you can use the SDK 3.1 as well as run it on older XCode versions.
The following steps may be helpful to resolve this issue
Download Facebook iOS SDK 3.0 from links present in the URL http://developers.facebook.com/ios/features/whats-new-ios-sdk-3/
Add the FacebookSDK framework from Mac Documents directory
Add sqlite3 to project
Then, I've tried the code in http://developers.facebook.com/docs/howtos/login-with-facebook-using-ios-sdk/ with the following changes (as it is for Facebook iOS SDK 3.1)
Replace openActiveSessionWithReadPermissions with openActiveSessionWithPermissions
Replace [FBSession.activeSession handleDidBecomeActive]; with [FBSession activeSession];
This worked for me. Try it once.
Thanks,
prodeveloper.

Library not loaded

I added Social.framework in my application in the same way i use to add the other frame works. I have downloaded xcode 4.5 and iOS 6 . but my application crashes with follwing error only on device. It works fine on simulator.
dyld: Library not loaded: /System/Library/Frameworks/Social.framework/Social
Referenced from: /var/mobile/Applications/FC88291D-2052-45D6-A7BB-65CE340F07BF/Uploading Image.app/Uploading Image
Reason: image not found
I was getting this exact error. My app currently has a deployment target of 5.1. I wanted to add Facebook sharing. I found this old post, Conditionally including a library for different iOS SDK versions?. All I did was set "Social.framework" to 'optional' and it did the trick, then my app would run on ios 5.1 and ios 6.0. Of course you need to do checks at runtime for what OS the device is running otherwise you could run into a crash if you try to access social.framework in ios 5.1 or earlier. Hope that helps!
In Xcode go to targets, Go to build phase and search for Social frame work you will find that under "Link Binary with Libraries" section. There select social frame work and see there is an option on right hand side required/optional in that just change required to optional. Now you are able to run on all ios devices without any crashes.

Compiling link error with xcode 4.2 for my iphone apps

I pass to xcode 4.2 and when I compile I have this error:
ld: library not found for -lz.1.2.3
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang
failed with exit code 1.
I am assuming lz is supposed to be libz. If that is the case, you are looking for a very specific version of the lib, so you're problem can be fixed by changing it to 1.2. This is done where you add frameworks (Coredata etc) in Xcode.
Hope this helps.

Trying to hack the AWS IOS SDK so that it works for OSX. I get this error

I've removed the import of the UIKit framework, and now I get this error. Do I have to somehow recompile the framework? It's not really giving me anything to go on...
And if it means anything, I am able to run the SDK examples in IOS so there aren't any system requirements that I'm not meeting.
ld: warning: ignoring file /Developer/SDKs/MacOSX10.7.sdk/Library/Frameworks//AWSiOSSDK.framework/AWSiOSSDK, missing required architecture x86_64 in file
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_AmazonS3Client", referenced from:
objc-class-ref in Constants.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
You can't just use the .framework provided by Amazon, because the binary is only for iOS. You need to rebuild the framework from the source, which thankfully comes in the SDK.
I created a XCode project with the source from the iOS SDK that appears to work. I have only tested some of the rudimentary S3 code but since it works in iOS, presumably, and I am able to communicate with S3, I think it should be good for all the services it supports.
https://bitbucket.org/danap/osx-aws-toolkit
Please feel free to fork and submit pull requests with changes.
I've created a fork of the AWS iOS SDK which can be built and used for Mac OS X development. Check it out: https://github.com/amberdixon/aws-sdk-ios. In the readme, I've included instructions on how to build the Mac OS X-compatible version of the AWS iOS SDK framework, which you can import into your OS X projects.