I am new in Twitter Fabric. I post a new tweet by using the code below
NSString *endpoint = @"https://api.twitter.com/1.1/statuses/update.json";
NSDictionary *parameters = @{@"status":@"a \n b"};
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);
}];
It is working well if the message does not contain break line (’\n’)
And if the message contains (’\n’) I will got the error
Error Domain=TwitterAPIErrorDomain Code=32 “Request failed: unauthorized (401)” UserInfo={NSLocalizedFailureReason=Twitter API error : Could not authenticate you. (code 32), NSErrorFailingURLKey=https://api.twitter.com/1.1/statuses/update.json, NSLocalizedDescription=Request failed: unauthorized (401)}
I do not know why this happened, please help me
Thank you