Hi everyone,
I created sample project for test a compose message by using REST API, but i got a problem.
This code i use for composing
NSString *endpoint = @"https://api.twitter.com/1.1/statuses/update.json";
NSError *error = nil;
NSDictionary *parameters = @{@"status":@"test message"};
TWTRAPIClient *client = [[TWTRAPIClient alloc] initWithUserID:[Twitter sharedInstance].sessionStore.session.userID];
NSURLRequest *request = [client URLRequestWithMethod:@"POST"
URL:endpoint
parameters:parameters
error:&error];
[client sendTwitterRequest:request completion:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
if (connectionError) {
NSLog(@"%@", connectionError);
}else{
NSLog(@"ok");
}
}];
-
If i immediately set this code in “viewDidAppear” method, the progress will be success.
-
If i set this code after 5 seconds, i will get error like this
2016-08-04 10:20:05.833 TestFabric[4750:945350] [Fabric] Unable to locate application icon
2016-08-04 10:20:10.653 TestFabric[4750:945373] Local time is off from UTC by 62735212799.346588 seconds
2016-08-04 10:20:11.651 TestFabric[4750:945377] Local time is off from UTC by 62735212799.348816 seconds
2016-08-04 10:20:11.653 TestFabric[4750:945350] Error Domain=TwitterAPIErrorDomain Code=135 "Request failed: unauthorized (401)" UserInfo={NSLocalizedFailureReason=Twitter API error : Timestamp out of bounds. (code 135), TWTRNetworkingStatusCode=401, NSErrorFailingURLKey=https://api.twitter.com/1.1/statuses/update.json, NSLocalizedDescription=Request failed: unauthorized (401)}
I use dispatch for delay 5 seconds
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
.... above code ....
});
I’ve already see someone say just changed the server timezone, but i use Xcode, how can i change it ?
Thank for any helping!