Its not the request. Like I already mentioned this has been working fine for a while. Here is the more complete code snippet. Trying to keep it concise… Really though. Params you can set to nil.
It’s not hard to reproduce. 1. Parse Twitter iOS Authentication. 2. Attempt the same Rest API call.
NSURL *verify = [NSURL URLWithString:[NSString stringWithFormat:@"https://api.twitter.com/1.1/search/tweets.json?q=%@%@&count=100", hashStr, @"%20-RT"]];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:verify];
NSDictionary *params = @{@"count" : @"100"};
NSError *jsonError;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:params options:NSJSONWritingPrettyPrinted error:&jsonError];
[request setHTTPBody:jsonData];
[[PFTwitterUtils twitter] signRequest:request];
NSURLResponse *response = nil;
NSData *data = [NSURLConnection sendSynchronousRequest:request
returningResponse:&response
error:nil];
NSError *error = nil;
NSDictionary *res;
if(data != nil){
res = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:&error];
}else{
return;
}
if (error != nil) {
NSLog(@"Error parsing JSON.");
NSLog(@"Error parsing JSON. %@ json:%@ data:%@ response:%@", error, jsonArray, data, response);
}
else {
NSLog(@"Array: %@", res);
NSArray *results = [res valueForKey:@"statuses"];
}