I've been trying to get OAuth for Twitter to work on my iPhone application for the last couple of days, and I cannot for the life of me figure out why I'm getting this error. I've changed the way I've been approaching this for a while now, but still nothing. So I turn to SO to hopefully figure it out.
The tutorial is linked here. Downloading the application and running it works PERFECTLY. It doesn't work for me.
Here's the error I get -
2010-07-25 20:04:52.224 AppTest[4620:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[OAToken setVerifier:]: unrecognized selector sent to instance 0x6c2acc0'
Anyone can tell me what I'm doing wrong? I'm using pretty much the same code.
EDIT: Here's the code where I use setVerifier:
- (IBAction)finishSetup:(id)sender {
NSString *thePin = [[NSString alloc] initWithString:pinText.text];
NSLog(@"%@", thePin);
if([thePin length] == 7 && [[NSScanner scannerWithString:thePin] scanInt:NULL]) {
loadingView.hidden = NO;
[pinText resignFirstResponder];
OAConsumer *consumer = [[OAConsumer alloc] initWithKey:consumer_key secret:consumer_secret];
OADataFetcher *fetcher = [[OADataFetcher alloc] init];
NSURL *url = [NSURL URLWithString:@"https://api.twitter.com/oauth/access_token"];
[accessToken setVerifier:pinText.text];
NSLog(@"Using PIN %@", accessToken.verifier);
OAMutableURLRequest *request = [[OAMutableURLRequest alloc] initWithURL:url consumer:consumer token:accessToken realm:nil signatureProvider:nil];
[request setHTTPMethod:@"POST"];
NSLog(@"Getting access token...");
[fetcher fetchDataWithRequest:request delegate:self didFinishSelector:@selector(accessTokenTicket:didFinishWithData:) didFailSelector:@selector(accessTokenTicket:didFailWithError:)];
} else {
loadingView.hidden = YES;
error_alert = [[UIAlertView alloc] initWithTitle:@"TestApp" message:@"The PIN you have entered is invalid. Please try again." delegate:self cancelButtonTitle:@"Cancel Login" otherButtonTitles:@"Try again", nil];
[error_alert show];
[error_alert release];
}
[thePin release];
}