0
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");
}

有人也得到这个错误吗?以及如何解决这个问题?

4

1 回答 1

1

我认为出现此问题是因为您的 twitter API 可能已被 twitter 弃用......使用最新的 twitter API 或在 iOS 5 或更高版本中工作的内置 Twitter 框架。它非常有用,也很容易.. :)

于 2012-05-09T13:16:27.367 回答