首页 > 解决方案 > 将 Youtube iOS 应用中的 URL 分享到我的 Codename One iOS 应用

问题描述

我需要将一个视频链接从 Youtube 应用程序共享到我在 iOS 上的 Codename One 应用程序。

根据:https ://stackoverflow.com/a/38036939/1277576,这似乎是可能的

使用 Codename One,我尝试添加这些构建提示:

ios.plistInject=<key>CFBundleURLTypes</key><array><dict><key>CFBundleURLName</key><string>net.informaticalibera.myappname</string></dict><dict><key>CFBundleURLSchemes</key><array><string>https</string></array></dict></array>
ios.urlScheme=<string>https</string>

我将此代码添加到一个简单的项目中:

public void start() {
        if (current != null) {
            current.show();
            return;
        }

        String url = Display.getInstance().getProperty("AppArg", null);

        Form hi = new Form("Test case", BoxLayout.y());
        if (url != null) {
            hi.add(new SpanLabel("Intercepted URL:\n" + url));
        } else {
            hi.add(new Label("No URL was intercepted"));
        }
        hi.show();
    }

但它不起作用:当我分享视频链接时,Youtube 为我提供了几个应用程序,但不是我的。

标签: codenameone

解决方案


您还需要在本机代码中实现它,如果我没记错的话,我认为 xcode 项目也需要更改。目前我们对此用例没有官方支持,但您可以为此提交 RFE。


推荐阅读