【问题标题】:App rejected by Apple because Auth0 signUpLink doesn’t open in Cordova InAppBrowser but in system browser (Safari)应用程序被 Apple 拒绝,因为 Auth0 signUpLink 未在 Cordova InAppBrowser 中打开,而是在系统浏览器 (Safari) 中打开
【发布时间】:2017-07-17 19:21:43
【问题描述】:

我们的 Ionic 2 移动应用被苹果拒绝,原因如下:

我们注意到用户被带到 Safari 以登录或注册帐户,这提供了糟糕的用户体验。 请修改您的应用程序以使用户能够在应用程序中登录或注册帐户。

Auth0 Lock 为用户提供了一个我们通过 Lock 的 signUpLink 选项配置的注册按钮。此按钮会在应用程序外部的系统浏览器 (Safari) 中打开一个注册页面,这显然是 Apple 无法接受的。

在我们升级到最新版本的 Ionic 2(Ionic 2 beta 11)之前,锁会打开 InAppBrowser 中的链接,这是 Apple 可以接受的。由于 Ionic 2 版本的差异,我想这可能是 Ionic 问题。

我确定我安装了Cordova InAppBrowser plugin。它在我的 config.xml 中以 <plugin name="cordova-plugin-inappbrowser" spec="~1.6.1" /> 的形式出现,当我在 XCode 中打开 .xcproject 文件时,插件出现在 Plugins 文件夹中。我还使用open('https://www.google.com/, '_blank'); 手动测试了使用 InAppBrowser,它打开了 InAppBrowser。

关于 Auth0 Lock 的代码和注册页面的 URL 都没有改变。

Auth0 Lock 版本:10.6(10.11也试过了,没解决问题)
离子版本:2.1.0 操作系统:iOS

自 Ionic 2 beta 11 以来,哪些会影响在 InAppBrowser 中打开链接的变化?

【问题讨论】:

标签: ios cordova angular ionic2 auth0


【解决方案1】:

我想出了一个肮脏的临时解决方法,方法是在window.open 函数中打开链接的按钮上添加一个onclick 属性:

    this.lock.on('show', () => {
        let parent: Element = undefined;
        let intervalIndex = 0;
        let interval = setInterval(() => {
            parent = document.getElementsByClassName('auth0-lock-tabs')[0];

            if (parent) {
                let item = parent.children.item(1).children.item(0);
                item.setAttribute('onclick', `window.open('${AppSettings.registrationUrl}', '_blank'); return false;`);
                item.removeAttribute('href');

                clearInterval(interval);
            }

            if (intervalIndex == 20)
                clearInterval(interval);

            intervalIndex++;
        }, 500);
    });

通过此修改,注册链接将在 InAppBrowser 中打开,因此不再违反 Apple 的条款。

注意:这不是解决此问题的好方法,也不能保证修复,因为在按钮上配置此 onclick 属性存在延迟。

【讨论】:

    猜你喜欢
    • 2017-06-07
    • 2019-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多