I'm running up against problems trying to incorporate some iOS5-specific libraries into an app targeted at both iOS5 and iOS4.3. I've gone through the following steps:
-
weakly-linked the Twitter framework by setting it as optional in 'Link Binary with Libraries"
-
added it as a framework for the iOS5.0 SDK in Other Linker Flags with `-framework Twitter.framework'
-
conditionally linked the framework in the class header:
#if defined(__IPHONE_5_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_5_0 #import <Twitter/Twitter.h> #import <Accounts/Accounts.h> #endif
-
then in the method itself, I'm then checking whether the user's set up for Twitter:
if ([TWTweetComposeViewController class]) { self.canTweet = [TWTweetComposeViewController canSendTweet]; }
This works beautifully on both the 5.0 and 4.3 simulators. However, I've got problems getting it to run on, or archive for, actual devices.
When I've got either a 3GS running 5.0, or a 4 running 5.0 attached, both show up twice in the Scheme dropdown. Selecting the top one, and attempting build or run the project fails with an Use of unidentified identifier 'TWTweetComposeViewController'
error.
Using the second device entry, the build fails with a ld: framework not found Twitter.framework
error.
I'm sure there's something I'm missing here, but I'm stumped. Can anyone advise?