1

実行するコード行を取得しました-

ACAccountStore *account = [[ACAccountStore alloc] init];
    ACAccountType *accountType = [account accountTypeWithAccountTypeIdentifier:
                                  ACAccountTypeIdentifierTwitter];

    [account requestAccessToAccountsWithType:accountType options:nil
                                  completion:^(BOOL granted, NSError *error)
    {
        if (granted == YES)
        {
            NSArray *arrayOfAccounts = [account
                                        accountsWithAccountType:accountType];

            if ([arrayOfAccounts count] > 0)
            {
                ACAccount *twitterAccount = [arrayOfAccounts lastObject];

                NSDictionary *message = @{@"status": @"My First Twitter post from iOS6"};

                NSURL *requestURL = [NSURL
                                     URLWithString:@"http://api.twitter.com/1/statuses/update.json"];

                SLRequest *postRequest = [SLRequest
                                          requestForServiceType:SLServiceTypeTwitter
                                          requestMethod:SLRequestMethodPOST
                                          URL:requestURL parameters:message];

                postRequest.account = twitterAccount;

                [postRequest performRequestWithHandler:^(NSData *responseData,
                                                         NSHTTPURLResponse *urlResponse, NSError *error)
                 {
                     NSLog(@"Twitter HTTP response: %i", [urlResponse 
                                                          statusCode]);
                 }];
            }
        }
    }];

アカウント タイプ オブジェクトをaccountsWithAccountType:メソッドに渡しているときに、空の配列を取得しました。このコードのデバッグを開始したときに、アカウント タイプオブジェクトの説明の下に表示されました。

accountType の印刷説明:

識別子: com.apple.twitter

説明: ツイッター

objectID: x-coredata://C4E0FB79-AAAF-4E87-92AD-C80137717067/AccountType/p25

サポート認証はい

複数のアカウントをサポートしますはい

supportedDataclasses (null)

syncableDataclasses (null)

私が見逃しているものはありますか?これを整理するのを手伝ってください。前もって感謝します。

4

0 に答える 0