4

私はIOSとのTwitterの統合で新しいです

だから、私はそれについて疑問を持っています。

Web 上の多くの例で、Twitter にアカウントが接続されていない場合、アラートを表示し、ユーザーを Twitter アカウントにログインする設定にリダイレクトするだけであることがわかりました。

Instagramのようなログインフォームを作るにはどうすればよいですか? ユーザーはどこに user_name と password を挿入して送信できますか?

私のコードは現時点では次のようになっています。

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];
      }
}];

誰かがSLRequestまたはACAccountを使用してそれを行う方法を知っているか、いくつかの例を持っていますか?

ありがとう

4

0 に答える 0