Man*_*day 3 appcelerator ios ios-universal-links appcelerator-titanium
我想允许我的用户打开我们的应用程序(如果已安装,否则重定向到App Store应用程序页面),每当用户点击我们网站的网址时.
我发现Universal Links是从iOS-9开始实现上述要求的一种方式.我也知道Web服务器和Apple Developer门户要涵盖的要点.
唯一的问题是如何在Appcelerator Titanium app中启用Associated Domains?
提前感谢任何线索或帮助.
我们使用此流程在我们的生产应用程序上为ios + android工作通用链接(基于AppC Handoff示例应用程序:
1)将Apple Dev Center上的关联域添加到应用程序 - >这将生成一个新的配置文件,您将要使用它来构建Titanium.
2)您需要显式编辑您的Entitlments.plist文件,通常这是由Ti自动生成的.要获取此文件的副本,请执行以下操作:
a) Build app for device
b) Navigate to project\build\iphone
c) Find the generated Entitlments.plist file
Run Code Online (Sandbox Code Playgroud)
3)将此文件复制到项目的根文件夹,并在"dict"节点下添加以下内容:
<key>com.apple.developer.associateddomains</key>
<array>
<string>applinks:www.example.com</string>
</array>
Run Code Online (Sandbox Code Playgroud)
这应创建必要的数据,以将应用程序绑定到正确的链接网站.
4)现在要实际捕获深链接点击+ url,你需要听取以下事件:Ti.App.iOS.continueactivity
例如:
Ti.App.iOS.addEventListener('continueactivity', function(e){
//Since this event can be fired from multiple cases
//we need to check if it was a deeplink that fired it
if(e.activityType === "NSUserActivityTypeBrowsingWeb"){
//Since it WAS from a deeplink, the event response contains some
//other useful data (see the docs link)
var deepLinkURL = e.webpageURL;
//From here you can navigate the app to a relevant page etc...
}
};
Run Code Online (Sandbox Code Playgroud)
可悲的是,这个功能在sdk 5.X中被破坏了,它在这里被修复:TIMOB-20220(一个单行)但它不会被包含在官方的.GA sdk中直到我听到的5.4.0(这是预定的在6月发布).
如果您还有其他问题,那么Ti Slack小组聊天也是一个很好的地方(一大堆活跃用户).
| 归档时间: |
|
| 查看次数: |
1004 次 |
| 最近记录: |