2014-11-17 3 views
0

여기에서 매우 힘든 시간을 보내고 있습니다. 내 응용 프로그램에는 STTwitter가 성공하고 아무 것도 반환하지 않는 다른 부분 (동일한 코드 사용)이있는 부분이 있습니다. `STTwitter가 아무 것도 반환하지 않음 성공 또는 오류가 없음

-(IBAction)followTwitter:(id)sender { 

if ([[NSUserDefaults standardUserDefaults] objectForKey:@"twitter_on_file" ] == nil) { 

    UIAlertView *allert = [[UIAlertView alloc] initWithTitle:@"Uh oh!" message:@"You have not linked your twitter account quite yet! Head to My Account settins to do so." delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil, nil]; 
    [allert show]; 

} else { 
    ACAccountStore *store1 = [[ACAccountStore alloc] init]; 
    ACAccountType *twitterAccountType = [store1 accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter]; 
    if ([twitterAccountType accessGranted]) { 
     [store1 requestAccessToAccountsWithType:twitterAccountType options:nil completion:^(BOOL granted, NSError *error) { 

      arrayOfUsernames = [[NSMutableArray alloc] init]; 

      iosAccounts = [store1 accountsWithAccountType:twitterAccountType]; 
      for (ACAccount *accou in iosAccounts) { 
       [arrayOfUsernames addObject:accou.username]; 
      } 

      NSString *usernameOnFile = [[NSUserDefaults standardUserDefaults] objectForKey:@"twitter_on_file" ]; 
      int tracker = 0; 

      for (NSString *username in arrayOfUsernames) { 

       if ([username isEqualToString:usernameOnFile]) { 
        NSLog(@"Using twitter account: %@", username); 
        STTwitterAPI *twitterAPI = [STTwitterAPI twitterAPIOSWithAccount:iosAccounts[tracker]]; 
        [twitterAPI verifyCredentialsWithSuccessBlock:^(NSString *username) { 
         NSLog(@"Successfully authenticated the user"); 

        } errorBlock:^(NSError *error) { 

         NSLog(@"Erorr: %@", error); 

        }]; 
        NSLog(@"Twitter API: %@", twitterAPI); 

        [twitterAPI postFriendshipsCreateForScreenName:@"kickscaterer" orUserID:nil successBlock:^(NSDictionary *befriendedUser) { 

         NSLog(@"Befriend %@", befriendedUser); 


        } errorBlock:^(NSError *error) { 

         NSLog(@"Error: %@", error); 
        }]; 
       } else { 
        tracker++; 
       } 
      } 
     }]; 
    } 
} 

을} `

작업을 수행하는 부분 :

STTwitterAPI *twitter= [STTwitterAPI twitterAPIOSWithAccount:iosAccounts[indexForAlert.row]]; 

     [twitter verifyCredentialsWithSuccessBlock:^(NSString *username) { 
      // ... 
      NSLog(@"Username: %@", username); 
      // [self.tableView reloadData]; 


      [[NSUserDefaults standardUserDefaults] setObject:twitter.userName forKey:@"twitter_on_file"]; 

     } errorBlock:^(NSError *error) { 
      NSLog(@"Error: %@", error); 
      // ... 
     }]; 

     [twitter postFriendshipsCreateForScreenName:@"didi4" orUserID:nil successBlock:^(NSDictionary *befriendedUser) { 

      NSLog(@"Befriend %@", befriendedUser); 


     } errorBlock:^(NSError *error) { 

      NSLog(@"Error: %@", error); 
     }]; 

감사를 작동하지 않습니다

부분!

답변

0

postFriendshipsCreateForScreenName: 메서드는 성공 블록 인 내에서 이라는 이름의 로그를 "사용자를 성공적으로 인증 함"로그와 동일한 수준으로 지정해야합니다.

+0

답장을 보내 주셔서 감사합니다. 나는 이것을 시도했으나 여전히 효과가있다. – user2918201

+0

잠깐 내가 문제를 발견했다고 생각한다. – user2918201

+0

자, 이제 사실은 지금 당신에게 감사드립니다. 그러나 오류를 반환합니다. 자격 증명에서이 리소스에 대한 액세스를 허용하지 않습니다. 내가 설정에서 로컬 iOS 계정을 사용하고 있다고 생각하면 이상합니다. – user2918201