403错误:disallowed_useragent [英] 403 Error: disallowed_useragent

查看:1782
本文介绍了403错误:disallowed_useragent的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是移动应用程序开发新手,我正在开发一个ios应用程序。其中我使用谷歌驱动器从谷歌帐户中获取文档文件到我的应用程序。我做了这个任务,工作得很好。但现在它不工作,现在当我尝试验证它显示 403错误:disallowed_useragent 在我的应用程序中。我google了一下,但有些令人困惑,我读了这个堆栈溢出问题

I am new to mobile application development, I am developing an ios app. In which I am using google drive to get document files into my app from google account.I did that task and worked fine.But now it is not working now when I try to authenticate it shows 403 Error: disallowed_useragent in my app . I googled regarding that but somethig confusing, I read this stack overflow question from that I found google drive has updated,now I donnot know whether I want redo my task or have to update task for signin only to complete it, kindly any one suggest me regarding that

感谢广告

推荐答案

在遵循Google驱动器API快速入门之后,将这3行代码添加到AppDelegate中。 m didFinishLaunchingWithOptions as below below。then it fine fine ...

After Following Google drive API Quick start, Add these 3 lines of code in AppDelegate.m didFinishLaunchingWithOptions as Shown below.. then it works fine ...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

     NSString *userAgent = @"Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/603.1.23 (KHTML, like Gecko) Version/10.0 Mobile/14E5239e Safari/602";

     // set default user agent

     NSDictionary *dictionary = [[NSDictionary alloc]initWithObjectsAndKeys:userAgent,@"UserAgent", nil];
     [[NSUserDefaults standardUserDefaults] registerDefaults:(dictionary)];

    return YES;
}

这篇关于403错误:disallowed_useragent的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆