我正在尝试使用 Shyambhat 的 InstagramKit(来自 DEV 分支),但无论如何我都无法在登录后将 Instagram 重定向到应用程序(以及应该捕获重定向 URL 的代码部分)我愿意。
在我的 Info.Plist 中我有:
InstagramAppRedirectURL: app://
在 Instagram 上我还有:
Redirect URI: app://
它总是相同的……它永远行不通。 (我已经尝试了 [myclientID]://authorize 和其他一些东西。)
我收到错误消息“错误:如果您有 cookie,则无法加载该页面...”
这是我的代码:
- (void)viewDidLoad {
[super viewDidLoad];
NSLog(@"Do we see the light of day?");
InstagramKitLoginScope scope = InstagramKitLoginScopeRelationships | InstagramKitLoginScopeComments | InstagramKitLoginScopeLikes;
NSURL *authURL = [[InstagramEngine sharedEngine] authorizationURLForScope:scope];
[self.webView loadRequest:[NSURLRequest requestWithURL:authURL]];
}
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
NSLog(@"Did instagram make it here?");
NSError *error;
if ([[InstagramEngine sharedEngine] receivedValidAccessTokenFromURL:request.URL error:&error]) {
// success!
NSLog(@"Instagram login successful");
}
return YES;
}
我们确实“看到了曙光”。我进入了登录屏幕……我登录了……但它从来没有进入“Instagram 在这里成功了吗?”
如有任何帮助,我们将不胜感激。
最佳答案
就像我说的......它从未进入 BOOL webView。结果我只需要在 viewWillAppear 中显式设置委托(delegate):
-(void)viewWillAppear:(BOOL)animated
{
_webView.delegate = self;
}
问题已解决。
关于ios - InstagramKit (ios) 登录验证问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38256873/