1

我正在尝试填充 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 (单独的线程)不为零,我就会得到令牌和秘密。

我可能不应该在这里完整发布它们,但这就是

证书

填充后看起来像:

oauth_token=OAtSGoYoXXXXXXXXXXXXXXhtUs4AT&oauth_token_secret=cGFYzLTqxXXXXXXXXXXXXbC6JEHtK&oauth_callback_confirmed=true

所以在子串之后,我有

oAuthToken:OAtSGoYoXXXXXXXXXXXXXXXhtUs4AT

oAuthSecret:cGFYzLTqxXXXXXXXXXXXXbC6JEHtK

但是,保存失败并出现以下错误:

错误:错误域=NSURLErrorDomain 代码=-1012 “操作无法完成。(NSURLErrorDomain 错误 -1012。)”

4

0 回答 0