ios – SLRequest – Twitter返回代码215(错误的身份验证数据)

ios – SLRequest – Twitter返回代码215(错误的身份验证数据),第1张

概述我在Instagram应用程序中有上传照片的应用程序.首先我的应用上传照片并返回链接.然后在状态消息中发送链接.当我在我的iPhone上测试时一切正常,但是当我在另一部iPhone上测试时,twitter会返回代码215错误的身份验证数据.什么想法可能是错的?谢谢回复. - (void)tweet:(NSString *)identifier withCompletionHandler:(void 我在Instagram应用程序中有上传照片的应用程序.首先我的应用上传照片并返回链接.然后在状态消息中发送链接.当我在我的iPhone上测试时一切正常,但是当我在另一部iPhone上测试时,twitter会返回代码215错误的身份验证数据.什么想法可能是错的?谢谢回复.

- (voID)tweet:(Nsstring *)IDentifIEr withCompletionHandler:(voID (^)())completionHandler {ACAccountStore *accountStore = [[ACAccountStore alloc] init];// Create an account type that ensures Twitter accounts are retrIEved.ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIDentifIEr:ACAccountTypeIDentifIErTwitter];// Request access from the user to use their Twitter accounts.[accountStore requestAccesstoAccountsWithType:accountType withCompletionHandler:^(BOol granted,NSError *error) {    if(granted) {        if (IDentifIEr) {            // Get the List of Twitter accounts.            NSArray *accountsArray = [accountStore accountsWithAccountType:accountType];            if ([accountsArray count] > 0) {                // Grab the initial Twitter account to tweet from.                NSURL *url = [NSURL URLWithString:@"https://API.twitter.com/1.1/statuses/update.Json"];                NSDictionary *dict = [NSDictionary dictionaryWithObject:[Nsstring stringWithFormat:@"Check out this great flick on BLA BLA %@",[BLA_URL stringByAppendingFormat:@"/%@/%@",@"flick",IDentifIEr]]                                                                 forKey:@"status"];                SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeTwitter                                                        requestMethod:SLRequestMethodPOST                                                                  URL:url                                                           parameters:dict];                [request setAccount:[accountsArray lastObject]];                [request performRequestWithHandler:^(NSData *responseData,NShttpURLResponse *urlResponse,NSError *error) {                    if ([urlResponse statusCode] == 200) {                        NSLog(@"TWEEET!");                    }                    else {                         NSError *JsonError;                        ID data = [NSJsONSerialization JsONObjectWithData:responseData                                                                  options:NSJsONReadingMutableLeaves                                                                    error:&JsonError];                        dispatch_async(dispatch_get_main_queue(),^{                            UIAlertVIEw *alertVIEw = [[UIAlertVIEw alloc] initWithTitle:@"Twitter response"                                                                                message:[Nsstring stringWithFormat:@"%d S: %d %@",[error code],[urlResponse statusCode],data]                                                                               delegate:self                                                                      cancelbuttonTitle:@"Ok"                                                                      otherbuttonTitles:nil];                            NSLog(@"NOOO TWEEET!");                            [alertVIEw show];                            completionHandler();                        });                    }                }];...

和预检功能:

- (IBAction)twitterbuttonTapped:(ID)sender {if ([self.twitterbutton isSelected]) {    [self.twitterbutton setSelected:NO];}else {    [self.twitterbutton setSelected:YES];    ACAccountStore *accountStore = [[ACAccountStore alloc] init];    ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIDentifIEr:ACAccountTypeIDentifIErTwitter];    [accountStore requestAccesstoAccountsWithType:accountType withCompletionHandler:^(BOol granted,NSError *error) {        if (!granted) {            [self.twitterbutton setSelected:NO];            UIAlertVIEw *alertVIEw = [[UIAlertVIEw alloc] initWithTitle:@"Twitter access"                                                                message:@"Please make sure you have allowed twitter for BLA BLA in your Settings."                                                               delegate:self                                                      cancelbuttonTitle:@"Ok"                                                      otherbuttonTitles:nil];            [alertVIEw performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:NO];        }    }];}

}

解决方法 好的,我有答案!问题是其他iPhone的帐户数据不完整 – 您必须在设置应用中填写用户名和密码. 总结

以上是内存溢出为你收集整理的ios – SLRequest – Twitter返回代码215(错误的身份验证数据)全部内容,希望文章能够帮你解决ios – SLRequest – Twitter返回代码215(错误的身份验证数据)所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1072185.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存