ios - 使用 UIWebView 在 iOS 应用程序中登录 Instagram 时出错

标签 ios iphone uiwebview instagram instagram-api

我正在关注 Instagram authentication [推荐] 在 iOS 应用程序上使用 UIWebView 的步骤。 输入凭据后,点击登录会加载一个页面,并出现以下错误。

This page could not be loaded. If you have cookies disabled in your browser, or you are browsing in private mode, please try enabling cookies or turning off private mode, and then retrying your action.

而且,这只会在首次运行身份验证步骤时发生;在下一次尝试中,一切都像丝绸一样顺畅。我得到后缀为重定向 url 的代码,并使用它请求访问 token 。

截图:

enter image description here

已经有另一个问题here但这没有帮助。

编辑: 似乎是 Cookies 问题。不过,我还没能修复它。

最佳答案

当我删除 cookie 以确保出现登录屏幕而不仅仅是使用当前登录的用户时,我遇到了类似的问题。尝试(快速):

let storage = HTTPCookieStorage.shared
storage.cookieAcceptPolicy = .always

关于ios - 使用 UIWebView 在 iOS 应用程序中登录 Instagram 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37660981/

相关文章:

iphone - 在实现文件中使用类别作为私有(private)方法?

ios - 使用 UIWebView+AFNetworking 时出现链接

ios - 在 UIWebView 上无法选择照片?

iphone - 提交之前,iPhone应用程序商店链接不起作用

iphone - 设备中未播放警告声音?

javascript - 如何在 UIWebView 中打开即时弹出窗口?

ios - 在扩展中声明属性并出现错误的访问错误

ios - 不同的 UIButton accessibilityLabel 取决于按钮是否被选中

objective-c - 更改 self.view 框架不起作用

ios - 在静态iOS库中强制使用ARC