Cloth Twitter login error when account is not set up?

I use twitter tweeter tweeter system with twitter and to get detailed user information. For this, I use the code below.

[[Twitter sharedInstance] logInWithCompletion:^
     (TWTRSession *session, NSError *error) {
         if (session) {
             NSLog(@"signed in as %@", [session userID]);
         } else {
             NSLog(@"error: %@", [error localizedDescription]);
         }
     }];

It works great when I set up a Twitter account in the iPhone settings. Added a username and password in the Twitter application for iPhone. But if it is empty and there is no Twitter account, I cannot log in and get an error. Request error: unauthorized (401)

Is there any way I can ask a user to enter their username and password?

Thanks in advance.

-Aakil

+4
source share
2 answers

, , , , . developer.twitter( -).

URL . (, )

.

+7

:

if (![TWTweetComposeViewController canSendTweet]) {
    NSLog(@"No Twitter Accounts");
}

, . , , - . :

TWTRLogInButton* logInButton =  [TWTRLogInButton
                                     buttonWithLogInCompletion:
                                     ^(TWTRSession* session, NSError* error) {
    if (session) {
         NSLog(@"signed in as %@", [session userName]);
    } else {
         NSLog(@"error: %@", [error localizedDescription]);
    }
}];
logInButton.center = self.view.center;
[self.view addSubview:logInButton]; 

, .

-1

All Articles