Request DBE044D8-3C3D-4122-95FF-F0E2063FB9DF failed with error: Error Domain=HTTP Code=403 "The operation couldn’t be completed. (HTTP error 403.)"
错误日志显示为当我想更新新推文时,我正在使用此代码
- (void) requestSucceeded: (NSString *) requestIdentifier {
CLog(@"Request %@ succeeded", requestIdentifier);
}
- (void) requestFailed: (NSString *) requestIdentifier withError: (NSError *) error {
CLog(@"Request %@ failed with error: %@", requestIdentifier, error);
}
-(void)twit:(NSString *)text{
CLog(@"test to tweet");
[_engine sendUpdate:@"hallo"];
}
- (IBAction)twitter:(id)sender {
NSString * user=[[NSUserDefaults standardUserDefaults] objectForKey:@"username"];
if(![user isNotEmpty]){
_engine=nil;
}
if(!_engine){
CLog(@"engine create");
_engine = [[[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate:self] autorelease];
_engine.consumerKey= kOAuthConsumerKey;
_engine.consumerSecret = kOAuthConsumerSecret;
}
if(![_engine isAuthorized]){
UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine:_engine delegate:self];
if (controller){
[self presentModalViewController:controller animated:YES];
[[BNUtilitiesQuick FrontPageofBadger] presentModalViewController:controller animated:YES];
}
}
}
#pragma mark SA_OAuthTwitterEngineDelegate
- (void) storeCachedTwitterOAuthData:(NSString *) data forUsername:(NSString *) username {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:data forKey:@"authData"];
[defaults setObject:username forKey:@"username"];
[defaults synchronize];
CLog(@"username:%@", username);
}
- (NSString *) cachedTwitterOAuthDataForUsername:(NSString *) username {
return [[NSUserDefaults standardUserDefaults] objectForKey:@"authData"];
}
- (void) OAuthTwitterControllerFailed:(SA_OAuthTwitterController *) controller{
CLog(@"failed");
}
- (void) OAuthTwitterControllerCanceled:(SA_OAuthTwitterController *) controller{
CLog(@"cancel");
}
任何人都会得到这个错误吗?以及如何解决这个问题?
答案 0 :(得分:1)
我认为出现此问题的原因是您的Twitter API可能已被弃用,也已被Twitter关闭.... 使用最新的Twitter API或在iOS 5或更高版本中运行的在线Twitter框架。 它非常有用而且非常容易.. :)