1

I am following the documentation of twitter and below is the example code they have given to check logged in user session and tweet using the TWTRComposer.

// Check if current session has users logged in
if ([[Twitter sharedInstance].sessionStore hasLoggedInUsers]) {
    TWTRComposerViewController *composer = [TWTRComposerViewController emptyComposer];
    [fromController presentViewController:composer animated:YES completion:nil];
} else {
    [[Twitter sharedInstance] logInWithCompletion:^(TWTRSession *session, NSError *error) {
        if (session) {
            TWTRComposerViewController *composer = [TWTRComposerViewController emptyComposer];
            [fromController presentViewController:composer animated:YES completion:nil];
        } else {
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"No Twitter Accounts Available" message:@"You must log in before presenting a composer." preferredStyle:UIAlertControllerStyleAlert];
            [self presentViewController:alert animated:YES completion:nil];
        }
    }];
}

Now, for the case when Twitter app is not installed, the flow goes to the else part given below:

else {
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"No Twitter Accounts Available" message:@"You must log in before presenting a composer." preferredStyle:UIAlertControllerStyleAlert];
    [self presentViewController:alert animated:YES completion:nil];
}

Twitterkit should open webview here to ask for twitter login, which is not happening. Anyone have any clue? Any help would be greatly appreciated.

Thanks & Cheers.

4

1 回答 1

1

经过多次试验后得到修复。修复是一件愚蠢的事情:

在 twitter 仪表板中转到您的应用程序:https ://apps.twitter.com/ > 转到应用程序设置 > 转到回调 URL 并填写任何工作 URL。瞧,如果未安装 Twitter 应用程序,它将加载 webview。

希望它可以帮助某人。

于 2018-01-10T16:49:41.277 回答