简体   繁体   中英

MGTwitterEngine (iPhone) won't send update to Twitter

I cant send status update on twitter.

Here is my code..

- (void) tweet{

_engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate:self];
_engine.consumerKey = @"someKey";
_engine.consumerSecret = @"someSecret";

UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine: _engine delegate: self];

if (controller)
    [self presentModalViewController: controller animated: YES];
else {
    tweets = [[NSMutableArray alloc] init];
    [self updateStream:nil];
}

[_engine sendUpdate:@"test"];
[self updateStream:nil];

}

Try using in this way:

- (void) tweet{


_engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate:self];
_engine.consumerKey = @"someKey"; //So please make sure that you had replaced the keys over here.
_engine.consumerSecret = @"someSecret";

UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine: _engine delegate: self];

if (controller)
    [self presentModalViewController: controller animated: YES];
else {
    tweets = [[NSMutableArray alloc] init];
   [_engine sendUpdate:[NSString stringwithFormat:@"Today Test Date is %@",[NSDate date]]]; // You will be able to post any tweet when you are successfully logged in.So post the message after login rather than 
   [self updateStream:nil];
}
}

I am sure it would work for you....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM