Search code examples
callbackios4twittermgtwitterenginetwitter-oauth

How do I Pull in errors when attempting to tweet from an iOS app using the Twitter+OAuth API?


How do I properly setup the callback method for a status update using the Twitter+OAuth API? (http://github.com/bengottlieb/Twitter-OAuth-iPhone)

Right now I'm using the following to determine if a request succeeded:

- (void)requestSucceeded:(NSString *)connectionIdentifier {
NSLog(@"Statuses Sent");
//[loadingActionSheet dismissWithClickedButtonIndex:0 animated:YES];
//[loadingActionSheet release];

}

What would I use to determine if a request failed?


Solution

  • Reading docs helps, implemented the following to solve my problem:

    - (void) requestFailed:(NSString *)connectionIdentifier withError: (NSError *) error; {
    NSLog(@"Status Update Failed");
    NSLog(@"Error: %@", error);
    [loadingActionSheet dismissWithClickedButtonIndex:0 animated:YES];
    [loadingActionSheet release];
    alert = [[UIAlertView alloc]
             initWithTitle:@"Error" message:@"Twitter did not receive your update, please try again later." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alert show];
    [alert release];
    }