简体   繁体   English

如何使用STTwitter for OSX在Twitter中登录?

[英]How to do login in Twitter using STTwitter for OSX?

Hello, 你好,

I am developing a Twitter client for OSX using STTwitter library. 我正在使用STTwitter库开发OSX的Twitter客户端。 I use this code to do login: 我使用以下代码进行登录:



    - (void) loginWithUser:(NSString*) user
                  password:(NSString*) password {
        twitter = [STTwitterAPI twitterAPIWithOAuthConsumerKey:kOAuthConsumerKey
                                                consumerSecret:kOAuthConsumerSecret
                                                      username:user
                                                      password:password];

        [twitter verifyCredentialsWithSuccessBlock:^(NSString *username) {
            _status = [NSString stringWithFormat:@"Access granted for %@", username];
            _isConnected = YES;
        } errorBlock:^(NSError *error) {
            _isConnected = NO;
            _status = [error localizedDescription];
            NSLog(@"Status: %@",_status);
        }];
    }

I can read direct messages using my personal Twitter account and other development Twitter account but if I try to use other Twitter account from my beta testers I can not read the direct messages. 我可以使用我的个人Twitter帐户和其他开发Twitter帐户阅读直接消息,但是如果我尝试从Beta测试人员使用其他Twitter帐户,则无法阅读直接消息。

The error message is: 错误消息是:

This application is not allowed to access or delete your direct messages. 不允许该应用程序访问或删除您的直接消息。

I tried to use an OSX system account to do login using this code: 我尝试使用OSX系统帐户使用以下代码登录:



    - (void) loginWithSystemAccount {
        twitter = [STTwitterAPI twitterAPIOSWithFirstAccount];
        [twitter verifyCredentialsWithSuccessBlock:^(NSString *username) {
            _status = [NSString stringWithFormat:@"Access granted for %@", username];
            _isConnected = YES;
        } errorBlock:^(NSError *error) {
            _isConnected = NO;
            _status = [error localizedDescription];
            NSLog(@"Status: %@",_status);
        }];
    }

But I can read direct messages using a system account. 但是我可以使用系统帐户阅读直接消息。

I checked the OSX Demo in STTwitter git repository but I could not find a solution. 我在STTwitter git存储库中检查了OSX Demo,但找不到解决方案。 How can I do a right login in Twitter for all users to read direct messages? 如何在Twitter中进行正确的登录,以使所有用户都能阅读直接消息?

Thanks in advance 提前致谢

At first, you should find out if it's a weird behaviour of Twitter API, or a bug in STTwitter. 首先,您应该确定这是Twitter API的怪异行为还是STTwitter中的错误。

To do so, I suggest that you try reading direct messages with twurl . 为此,建议您尝试使用twurl阅读直接消息。

If you're not sure which endpoints you're calling, enable STTwitter networks logs with the STHTTPRequestShowCurlDescription argument. 如果不确定要调用的终结点,请使用STHTTPRequestShowCurlDescription参数启用STTwitter网络日志。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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