iOS5에서 새 트위터 계정을 만들고 ACAccountStore
에 저장하는 데 문제가 있습니다.iOS5에서 트위터 ACAccount를 생성하는 중 오류가 발생했습니다. NSURLErrorDomain 오류 -1012
계정을 초기화하는 모든 단계를 수행 한 후에 ACAccountStore's
saveAccount:withCompletionHandler:
은 NSURLErrorDomain error -1012
을 반환합니다.
비슷한 문제가있는 사람이 있습니까?
아래 코드 샘플은 requestToken을 사용하여 ACAccountCrendential
으로 초기화합니다. 이 객체는 OAuth
을 완료 한 후 트위터로부터받은 토큰과 비밀로 초기화 된 OAToken
(ShareKit 객체)입니다. 자격 증명을 사용하여
계정 유형은 인증을 지원하고 계정이 인증되지 않은 경우, 계정 인증 :
ACAccountStore *store = [[[ACAccountStore alloc] init] autorelease]; ACAccountType *twitterAccountType = [store accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter]; ACAccount *account = [[[ACAccount alloc] initWithAccountType:twitterAccountType] autorelease]; account.username = @"twitterusername"; account.credential = [[[ACAccountCredential alloc] initWithOAuthToken:requestToken.key tokenSecret:requestToken.secret] autorelease]; [store requestAccessToAccountsWithType:twitterAccountType withCompletionHandler:^(BOOL granted, NSError *error) { if (granted) { [store saveAccount:account withCompletionHandler:^(BOOL success, NSError *error) { if (success) { NSLog(@"TWITTER ACCOUNT CREATED SUCCESSFULLY!"); } else{ NSLog(@"ERROR creating twitter account: %@", [error description]); } }]; } }];
이상한 것은 애플의 Accounts Framework Reference가
saveAccount:withCompletionHandler:
시도OAuth
자체를 수행 할 것을 제안이다 . 인증에 성공하면 계정이 저장됩니다. 그렇지 않으면 저장되지 않습니다.
사용자 이름/암호를 입력하여 사용자가 직접 서버를 인증 할 수있는 방법이 없기 때문에 매우 이상합니다.
나는 또한이 주제에 대한 모든 지침을 크게 감상 할 수
(NSURLErrorDomain error -1012.
실패했습니다) 같은 결과로, 내 응용 프로그램의 소비자 키 및 소비자 비밀로 ACAccountCredential
를 초기화하려고!
감사합니다.