OAConsumer API を使用してデータをフェッチしようとしています。次のコードを試してみましたが、エラーが発生しました。
-(void)performQuery
{
OAConsumer *consumer = [[OAConsumer alloc] initWithKey:OAUTH_KEY
secret:OAUTH_SECRET];
NSURL *url = [NSURL URLWithString:@"https://api.semantics3.com/v1/products"];
OAMutableURLRequest *request = [[OAMutableURLRequest alloc] initWithURL:url
consumer:consumer
token:nil
realm:nil
signatureProvider:nil]; // use the default method, HMAC-SHA1
[request setHTTPMethod:@"GET"];
[consumer release];
OARequestParameter * qParam = [[OARequestParameter alloc] initWithName:@"q" value:@"{\"cat_id\":13658,\"model\":\"Satellite\"}"];
NSArray *params = [NSArray arrayWithObjects:qParam, nil];
[qParam release];
[request setParameters:params];
OADataFetcher *fetcher = [[OADataFetcher alloc] init];
[fetcher fetchDataWithRequest:request
delegate:self
didFinishSelector:@selector(requestDidFinishWithData:)
didFailSelector:@selector(requestDidFailWithError:)];
[request release];
}
エラーは次のとおりです。
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[OAServiceTicket bytes]: unrecognized selector sent to instance 0x1ed65bf0'
エラーは次の行で発生します: **NSString response= [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
- (void)requestDidFinishWithData:(NSData *)data {
NSString *response= [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding];
//here do what you want with the response, I use SBJson to parse it.
NSLog(@"Request success!%@", response);
[responseBody release];
}
- (void)requestDidFailWithError:(NSError *)error {
NSLog(@"Request did fail with error: %@", [error localizedDescription]);
}
私がここで何をしているのか分かりますか?