I’m using the sample Objective-C code found here to try to send a GET statuses/user_timeline request in an iOS application. However, when I call [client URLRequestWithMethod] it returns a null NSURLRequest. The error parameter I pass in isn’t getting filled with anything, so nothing is happening there. I’ve tried formatting my own request using Apple’s NSURLRequest methods, but when I pass that into [client sendURLRequest] I get radio silence…not even an error response. My code is below (“screenName” is a variable that I have checked for correctness). What can I do to resolve this issue?
NSString *reqString = @"https://api.twitter.com/1.1/statuses/user_timeline.json";
NSDictionary *params = @{@"screen_name" : screenName, @"count" : @"200"};
NSError *clientError;
NSURLRequest *request = [self.twitterClient URLRequestWithMethod:@"GET" URL:reqString parameters:params error:&clientError];
if(clientError){
NSLog(@"Client error: %@", clientError);
}
NSLog(@"URL Request: %@", request);
// fire away
[self.twitterClient sendTwitterRequest:request completion:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
if (data) {
// handle the response data e.g.
NSLog(@"Got response!");
NSError *jsonError;
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError];
NSLog(@"%@", json);
}
else {
NSLog(@"Error: %@", connectionError);
}
}];