i used MGTwitterEngine and its not working the application crashes after successful login attempt please hel开发者_运维问答p me
here is my code @Yorxxx
I just use the MGTwitterEngine:
following are the website i take the tutorial for help but its not working :(
#pragma mark twitter
- (void) twitterAction{
if(_engine) return;
_engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate:self];
_engine.consumerKey = @"pDFl6Og4Uwq2qEoJaOiuw";
_engine.consumerSecret = @"p3gxIDewgK3nxueJIRKPoSoFEpp8RtIryglvOrwSQA";
UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine: _engine delegate: self];
if (controller)
[self presentModalViewController: controller animated: YES];
else {
tweets = [[NSMutableArray alloc] init];
[self updateStream:nil];
}
}
-(IBAction)updateStream:(id)sender {
[_engine getFollowedTimelineSinceID:1 startingAtPage:1 count:100];
}
-(IBAction)tweet:(id)sender {
[_engine sendUpdate:@"Testing Testing Testing ... Please Wait"];
[self updateStream:nil];
}
#pragma mark SA_OAuthTwitterEngineDelegate
- (void) storeCachedTwitterOAuthData: (NSString *) data forUsername: (NSString *) username {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject: data forKey: @"authData"];
[defaults synchronize];
}
- (NSString *) cachedTwitterOAuthDataForUsername: (NSString *) username {
return [[NSUserDefaults standardUserDefaults] objectForKey: @"authData"];
}
#pragma mark SA_OAuthTwitterController Delegate
- (void) OAuthTwitterController: (SA_OAuthTwitterController *) controller authenticatedWithUsername: (NSString *) username {
NSLog(@"Authenticated with user %@", username);
tweets = [[NSMutableArray alloc] init];
[self updateStream:nil];
}
- (void) OAuthTwitterControllerFailed: (SA_OAuthTwitterController *) controller {
NSLog(@"Authentication Failure");
}
- (void) OAuthTwitterControllerCanceled: (SA_OAuthTwitterController *) controller {
NSLog(@"Authentication Canceled");
}
精彩评论