代号一。 IOS 拦截 URL 问题。

codename one. IOS intercepting URLs issue.

我希望我的应用程序在外部应用程序中打开时能够拦截 urls。我设法使用 android.xintent_filter 构建提示和 url 方案 "http" 使其在 android 上运行。但是它不适用于 ios。我完全按照此处的说明添加了此构建提示:http://www.codenameone.com/blog/intercepting-urls-on-ios-android.html ...

<key>CFBundleURLTypes</key>     <array>         <dict>              
<key>CFBundleURLName</key>               
<string>www.mibrand.co.za</string>           
</dict>         <dict>             <key>CFBundleURLSchemes</key>               
<array>                 <string>http</string>             </array>             
</dict>     </array> 

我什至尝试将 url 方案更改为 "myapp" 因为我在某处读到 ios 不允许应用程序拦截 http url 方案但它仍然没有'不工作。我做错了什么?

另外一个注意事项。我读到的关于 ios 和 http url 方案的内容是正确的。因为当我尝试将 android.xintent 构建提示中的 url 方案更改为 "myapp" android 手机不会将文本作为 link 接收,因此不能打开它们,所以我不得不使用 http url 方案。但是,如果这对 ios 不起作用,那么我就有点麻烦了。我该如何解决这个问题?

这在 iOS 上是不可能的。使用 info.plist 的 url 方案部分中定义的 url 可以直接从其他应用程序打开应用程序,但它无法拦截来自其他应用程序的 http 调用。

唯一的其他选择(如果 url 链接到您拥有的网站)是使用通用链接,通用链接是在 iOS 9 中引入的,可以在此处找到文档: https://developer.apple.com/library/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html

请记住,通用链接仅适用于您拥有的网站,不适用于您不拥有的网站。

您是否在使用 Facebook 集成 check this out

具体来说:

However, that can conflict with the Facebook integration if you use FacebookConnect which needs access to the schemes. To workaround it you can use the build hint ios.urlScheme e.g.:

ios.urlScheme=<string>myapp</string>