I’m working on the first iOS application using Fabric.
I want to implement post tweet. (using “POST /statuses/update.json” endpoint)
Part of implementation is as below.
NSString *endpoint = @"https://api.twitter.com/1.1/statuses/update.json";
NSDictionary *parameters = @{@"status":@"I went to [Central Park]"};
TWTRAPIClient *client = [[Twitter sharedInstance] APIClient];
NSURLRequest *request = [client URLRequestWithMethod:@"POST"
URL:endpoint
parameters:parameters
error:nil];
[client sendTwitterRequest:request
completion:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
if (connectionError) {
NSLog(@"Error: %@", connectionError);
return;
}
NSLog(@"Result : %@", data);
}];
When I use square brackets ([ and ]), request failed.
Description of NSError object is as below.
Error Domain=TwitterAPIErrorDomain
Code=32 "Request failed: unauthorized (401)"
UserInfo=0x7fd13e56e4d0 {NSErrorFailingURLKey=https://api.twitter.com/1.1/statuses/update.json, NSLocalizedDescription=Request failed: unauthorized (401), NSLocalizedFailureReason=Twitter API error : Could not authenticate you. (code 32)}
But, When I don’t use square brackets, request succeeded.
Is Using square brackets forbidden?