I am using twitter using Sharekit and for IOS5, I am using its class TWTweetComposeViewControllerClass as,
Class TWTweetComposeViewControllerClass = NSClassFromString(@"TWTweetComposeViewController");
if (TWTweetComposeViewControllerClass != nil) {
if([TWTweetComposeViewControllerClass respondsToSelector:@selector(canSendTweet)]) {
UIViewController *twitterViewController = [[TWTweetComposeViewControllerClass alloc] init];
[twitterViewController performSelector:@selector(setInitialText:)
withObject:NSLocalizedString(@"TwitterMessage", @"")];
[self.navigationController presentModalViewController:twitterViewController animated:YES];
[twitterViewController release];
}
} else {
[SHK flushOfflineQueue];
SHKItem *item = [SHKItem text:text];
//[SHKTwitter shareItem:item];
SHKActionSheet *actionsheet = [SHKActionSheet actionSheetForItem:item];
[actionsheet showFromToolbar:self.navigationController.toolbar];
}
It is working fine with simulator 5.0 but crashes on 4.3 with below error.
dyld: Library not loaded: /System/Library/Frameworks/Twitter.framework/Twitter
Referenced from: /Users/indianic/Library/Application Support/iPhone Simulator/4.3.2/Applications/241167D0-62E0-4475-85FD-0B8253B4E456/demoFBTW.app/demoFBTW
Reason: image not found
How do I fix this.
I tried to change the dependency for the framework from Required to Optional but didn’t find for that
It looks like you found how to weak link the framework. Assuming you are using Xcode 4.2 and LLVM3, you can also simplify this code a bit and fix a bug you have while you’re at it: