ios - InstagramKit (ios) 登录验证问题

标签 ios sdk instagram

我正在尝试使用 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/

相关文章:

iphone - 如何获取属于某个人 ABAddressBook 的组

java - 单击按钮时 Android 倒计时器应用程序崩溃

android - Eclipse Android 2.2项目报错但是Android 4.0没有报错

ios - Instagram - 如何在 Objective C 中使用 API 关注用户

node.js - 使用node.js将Instagram图片保存到本地文件夹中

iphone - 写入钥匙串(keychain)失败

iOS滑动距离与加速度计

oauth-2.0 - Instagram API : how can I have multiple redirect_uris for a single app?

objective-c - 从 CIImage 在 drawRect : 中绘制 UIImage

ios - Realm 中主键查找的性能?