IOS7 - SLComposeViewController - Error posting to Twitter - cannot send tweet - connection failed
Asked Answered
F

1

6

I'm trying to implement a twitter post using IOS7 SLComposeViewController and I get the following error -

The Tweet "blah blah" cannot be sent because the connection to twitter failed.

I am including image and URL in my tweet - if that makes any difference..

code below -

SLComposeViewController *composeController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];

[composeController setInitialText:@"i ran with 18 chickens under my armpits for 18 hours"];
[composeController addImage:[UIImage imageNamed:@"zoeLrg.png"]];
[composeController addURL: [NSURL URLWithString:
                            @"http://www.nme.com"]];

[self presentViewController:composeController
                   animated:YES completion:nil];

SLComposeViewControllerCompletionHandler myBlock = ^(SLComposeViewControllerResult result){
    if (result == SLComposeViewControllerResultCancelled) {

        NSLog(@"delete");

    } else

    {
        NSLog(@"post");
    }

    [composeController dismissViewControllerAnimated:YES completion:Nil];
};
composeController.completionHandler =myBlock;
Fatness answered 14/11, 2013 at 15:55 Comment(1)
see #9837785 ;)Heed
A
4

Can you check your debug console to see what error is returned? Typically, those messages will be more informative. Also, if you have multiple accounts configured on your device, there is an open radar issue related to it which may apply in your case. Please check http://www.openradar.me/radar?id=5262535380959232.

Avraham answered 14/11, 2013 at 21:10 Comment(2)
it was indeed the open radar issue - went to settings and re-entered password - got some green ticks - tried again - all cool! Cheers for your help..Fatness
This hit us also on iOS7 phones. Thank you. Even though the user had gone into the Twitter App and reset the password… it was NOT until they did a password set under Settings->Twitter that we were able to tweet using the SLComposeViewController social framework. The console had these error messages: Unable to get entitlement 'com.apple.private.social.twitter.service' and The connection to com.apple.twitter.xpc was invalidated.Mandrill

© 2022 - 2024 — McMap. All rights reserved.