我正在尝试填充并将ACAccount保存到ACAccountstore,如下所示:
ACAccount *account = [[ACAccount alloc]initWithAccountType:twitterAccountType];
account.username = @"hansaaaha";
while (twitterRequest.rstring == nil)
{
continue;
}
NSString *credentails = twitterRequest.rstring;
NSString *oAuthToken = [credentails componentsSeparatedByString:@"&"][0];
NSString *oAuthSecret = [credentails componentsSeparatedByString:@"&"][1];
oAuthToken = [oAuthToken componentsSeparatedByString:@"="][1];
oAuthSecret = [oAuthSecret componentsSeparatedByString:@"="][1];
account.credential = [[ACAccountCredential alloc]initWithOAuthToken:oAuthToken tokenSecret:oAuthSecret];
[store saveAccount:account withCompletionHandler:^(BOOL success, NSError *error) {
if (success)
NSLog(@"a");
else
NSLog(@"Error: %@", error);
}];
一旦twitterRequest.rstring(单独的线程)不是nil,我就会获得令牌和秘密。
我可能不应该在这里完整发布,但这就是
凭证
看起来就像填充一样:
组oauth_token = OAtSGoYoXXXXXXXXXXXXXXhtUs4AT&安培; oauth_token_secret = cGFYzLTqxXXXXXXXXXXXbC6JEHtK&安培; oauth_callback_confirmed =真
所以在子字符串之后,我有
oAuthToken:OAtSGoYoXXXXXXXXXXXXXXhtUs4AT
oAuthSecret:cGFYzLTqxXXXXXXXXXXXbC6JEHtK
但是,保存失败并出现以下错误:
错误:错误域= NSURLErrorDomain代码= -1012“操作无法完成。(NSURLErrorDomain错误-1012。)”