not able to post tweets in userwall using twitter+OAuth
I used twit开发者_如何学Pythonter Oauth and it worked perfectly fine.I was able to login using twitter oauth api.The problem is i m not able to tweet from my iphone app .I ve created a login button a textfield and a post button.cud u guys help me out.below is the code
-(IBAction)login
{
if (engine) {
return;
}
engine=[[SA_OAuthTwitterEngine alloc]initOAuthWithDelegate:self];
engine.consumerKey=@"g3Fd0ZY085Z25ZNOQoznw";
engine.consumerSecret=@"SGQazb5sKTXjgb96N8tlt3ezR32Dy46LknOjxX4ktE";
UIViewController *controller=[SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine:engine delegate:self];
if (controller) {
[self presentModalViewController:controller animated:YES];
}
}
-(IBAction)Tweet
{
[engine sendUpdate:filed.text];
}
-(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"];
}
- (void) requestSucceeded: (NSString *) requestIdentifier
{
NSLog(@"Request %@ succeeded", requestIdentifier);
}
- (void) requestFailed: (NSString *) requestIdentifier withError: (NSError *) error
{
NSLog(@"Request %@ failed with error: %@", requestIdentifier, error);
}
Use share-kit ,it will guide through your problems.
精彩评论