codename one. IOS intercepting URLs issue.

时间:2016-04-15 14:45:21

标签: android ios url codenameone

I want my app to be able to intercept urls when opened in an external application. I managed to get it working on android using the android.xintent_filter build hint with the url scheme "http". However it does not work on ios. I added this build hint exactly as instructed here: 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> 

I even tried changing the url scheme to "myapp" because I read somewhere that ios does not allow apps to intercept http url schemes however it still didn't work. What am I doing wrong?

And on another note. Is what I read true about ios and http url schemes. Because when I try changing the url scheme in my android.xintent build hint to "myapp" android phones don't pick up the text as a link and therefore cannot open them so I am forced to use the http url scheme. But if that doesn't work for ios then I am in a bit of a problem. How do I work around this?

2 个答案:

答案 0 :(得分:1)

您使用的是Facebook集成check this out

具体做法是:

  

但是,如果您使用,可能会与Facebook集成冲突   FacebookConnect需要访问这些计划。解决它   你可以使用构建提示ios.urlScheme例如:

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

答案 1 :(得分:0)

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

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

请注意,Universal Links仅适用于您拥有的网站,而不适用于您不拥有的网站。