@bonnell: thanks for your reply. It does seem very strange.
Hereâs the Objective C code:
[[Twitter sharedInstance] logInWithCompletion:^(TWTRSession *session, NSError *error) {
if (session)
{
NSLog(@"signed in as %@", [session userName]);
TWTRComposer *composer = [[TWTRComposer alloc] init];
[composer setText: text]];
[composer setImage: image];
[composer setURL: url ];
// Called from a UIViewController
[composer showFromViewController:self completion:^(TWTRComposerResult result) {
if (result == TWTRComposerResultCancelled) {
NSLog(@"Tweet composition cancelled");
[[Twitter sharedInstance].sessionStore logOutUserID:[session userID]];
}
else {
NSLog(@"Sending Tweet!");
[[Twitter sharedInstance].sessionStore logOutUserID:[session userID]];
}
}];
}
else
{
NSLog(@"error: %@", [error localizedDescription]);
UIAlertController *noTwitterAlertController = [UIAlertController alertControllerWithTitle:@"Please connect your device to Twitter" message:@"Your device isn't associated with a Twitter account. Please connect to an account in your device settings." preferredStyle:UIAlertControllerStyleAlert];
[self presentViewController:noTwitterAlertController animated:YES completion:nil];
}
}];
Hereâs the console output:
2016-07-15 10:42:24.756 <AppName>[3201:1707748] signed in as <username>
2016-07-15 10:42:27.753 <AppName>[3201:1707748] Sending Tweet!
2016-07-15 10:56:03.853 <AppName>[3201:1710505] plugin com.apple.share.Twitter.post invalidated
Once this displays the TWTRComposerâs view disappears and the user can continue using the app.
On the device with the Twitter app installed, the tweet is not posted. When the Twitter app launches, it displays an UIAlertView (or UIAlertController styled to Alert) with this title: âTweet failed to sendâ, message: âYour Tweet couldnât be sent and has been saved as a draft.â, options: âDraftsâ, âOKâ.
What else I can think of that might be relevant so far:
Iâm using Xcode 7.3.
The appâs been developed and maintained in Objective C, but if thereâs a Swift solution I can use that too.
The app has been developed to support iOS 7, for which Cocoapods has installed TwitterKit 1.15.3. Iâve tried increasing the minimum deployment target to iOS 8.0, so that Cocoapods can install the latest TwitterKit, 2.3.0. This has made no difference to the experienced problem.
The device which successfully tweets is an iPod Touch running iOS 8.4. The device which has Twitter installed and fails is an iPad mini 2 running the latest iOS 9.3.
In the project:
<TwitterKit/TwitterKit.h> is imported in the .m file with the above code.
[Fabric with:@[[Crashlytics class], [Twitter class]]]; is called in the AppDelegateâs application:didFinishLaunchingWithOptions: method.
Both Crashlytics and Twitter have been added to the appâs Info.plist, as dictionaries in the Fabric/Kits array. The dictionary whose KitName is âTwitterâ has a KitInfo dictionary containing the appâs consumerKey and consumerSecret.
Any suggestions?