0

我使用 OAuthTwitterDemo,它给出了错误 [OAConsumer initWithKey:secret:]: unrecognized selector sent to instance 0x85b8dc0

我使用此方法登录...

if (_engine) return;
_engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate: self];
_engine.consumerKey = kOAuthConsumerKey;
_engine.consumerSecret = kOAuthConsumerSecret;

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

if (controller) 
    [self presentModalViewController: controller animated: YES];
else {
    [_engine sendUpdate: [NSString stringWithFormat: @"Already Updated. %@", [NSDate date]]];
}

但是登录不显示,它给出了一个错误......

[OAConsumer initWithKey:secret:]:无法识别的选择器发送到实例 0x85b8dc0 并导致 App 崩溃。

4

2 回答 2

0

您必须在此处插入您的 kOAuthConsumerKey 和您的 kOAuthConsumerSecret:

_engine.consumerKey = kOAuthConsumerKey;
_engine.consumerSecret = kOAuthConsumerSecret;

如果你不这样做,它会崩溃。您收到的错误“[OAConsumer initWithKey:secret:]: unrecognized selector sent to instance 0x85b8dc0 and crash App”指向未插入的 kOAuthConsumerSecret 的值。

于 2012-07-05T08:21:26.977 回答
0

我使用了下面的代码,它对我来说工作正常。检查您的消费者密钥和消费者密钥。

if(!_engine){
        _engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate:self];
        _engine.consumerKey    = kOAuthConsumerKey;
        _engine.consumerSecret = kOAuthConsumerSecret;  

    }

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

    if (controller)
        [self presentModalViewController:controller animated: YES];
于 2012-07-05T07:29:37.537 回答