우선, iOS7 프레임 워크 또는 Twitter의 Native API를 사용하여 트위터의 API에서 사용자 이메일 주소를 가져올 수 없습니다.
사용자 이메일 주소를 얻으려면 수동으로 입력하도록 요청할 수 있습니다. 그것은 트위터 사람들이 API Docs에서 말하는 것입니다. 귀하의 포인트 2 및 3 여기에 iOS7 방법을 사용하여 샘플 코드입니다
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]) // check Twitter is configured in Settings or not
{
self.accountStore = [[ACAccountStore alloc] init]; // you have to retain ACAccountStore
ACAccountType *twitterAcc = [self.accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
[self.accountStore requestAccessToAccountsWithType:twitterAcc options:nil completion:^(BOOL granted, NSError *error)
{
if (granted)
{
self.twitterAccount = [[self.accountStore accountsWithAccountType:twitterAcc] lastObject];
NSLog(@"Twitter UserName: %@, FullName: %@", self.twitterAccount.username, self.twitterAccount.userFullName);
[self getTwitterEmail]; // here you can ask user to enter email address. Its up to you how you ask user about it. Either in alert View or in Text Field.
}
else
{
if (error == nil) {
NSLog(@"User Has disabled your app from settings...");
}
else
{
NSLog(@"Error in Login: %@", error);
}
}
}];
}
else
{
NSLog(@"Not Configured in Settings......"); // show user an alert view that Twitter is not configured in settings.
}
이 작업을 수행 했습니까? – DAMM108
@ DAMMM108 : 답장을 보내 주셔서 감사합니다. 이전 twitter api를 사용하여이 작업을 수행했지만 ios 표준 라이브러리에서이 작업을 수행하려고합니다. 그것은 가능한가? 감사합니다 –
그게 아니야 IOS 표준 프레임 워크 대신 https://github.com/nst/STTwitter를 사용하는 것이 불가능합니다. – DAMM108