4

I'm newer in twitter integration with IOS

So, I have a doubt about that.

I saw in many examples on the web that when you don't have an account connected in twitter, you just show an alert and redirect the user to the Setting to login in twitter account.

How can I make a login form like instagram? Where the user can insert user_name and password and submit it?

My code is like this at the moment:

accountStore = [[ACAccountStore alloc] init];
ACAccountType *twitterType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];

// Request access from the user to use their Twitter accounts.
[accountStore requestAccessToAccountsWithType:twitterType options:nil completion:^(BOOL granted, NSError *error) {
      if (granted == YES){
      //get accounts to use.
      accounts = [accountStore accountsWithAccountType:twitterType];
      if ([accounts count] > 0) NSLog(@"account: %@", accounts);
      }else{
         // show alert to inser user_name and password to login on twitter
         alertTwitterAccount = [[UIAlertView alloc]
                                      initWithTitle:@"Enter with your twitter account"
                                            message:nil
                                           delegate:self
                                  cancelButtonTitle:@"Cancel"
                                  otherButtonTitles:@"Login", nil];
         [alertTwitterAccount setAlertViewStyle:UIAlertViewStyleLoginAndPasswordInput];
         [[alertTwitterAccount textFieldAtIndex:0] setPlaceholder:@"User"];
         [alertTwitterAccount setDelegate:self];
         [alertTwitterAccount setTag:1];
         [alertTwitterAccount show];
      }
}];

Anyone have some example or know how to do it using SLRequest or ACAccount?

Thanks

sidneivl
  • 242
  • 3
  • 12

0 Answers0