Hello,
I’m using fabric 1.14 on my iOS app.
I’m logged in and GET Requests work flawlessly.
But POST Requests always return me this error:
Error: Error Domain=TWTRNetworkingErrorDomain Code=-1011 "Request failed: unauthorized (401)" UserInfo={NSLocalizedFailureReason=, NSErrorFailingURLKey=https://api.twitter.com/1.1/favorites/create.json, NSLocalizedDescription=Request failed: unauthorized (401)}
Regarding that my user is authenticated, what is causing this rejection form twitter’s server ?
My code here:
NSString *userID = [Twitter sharedInstance].sessionStore.session.userID;
TWTRAPIClient *client = [[TWTRAPIClient alloc] initWithUserID:userID];
NSError *clientError;
NSURLRequest *request = [client URLRequestWithMethod:method URL:baseURL parameters:params error:&clientError];
if (request) {
[client sendTwitterRequest:request completion:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
if (data) {
// handle the response data e.g.
NSError *jsonError;
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError];
callback(@[[NSNull null], json]);
}
else {
NSLog(@"Error: %@", connectionError);
callback(@[connectionError.localizedDescription, [NSNull null]]);
}
}];
}
else {
NSLog(@"Error: %@", clientError);
callback(@[clientError.localizedDescription, [NSNull null]]);
}