我希望在我自己的应用程序中使用iOS上其他应用程序的现有功能。据我所知,应该能够使用URL自定义方案: https://developer.apple.com/library/content/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Inter-AppCommunication/Inter-AppCommunication.html
现在,在我作为听众的TryingService
胶子应用程序中,我正在使用RuntimeArgsService
来监听LAUNCH_URL_KEY
。在我的Default-Info.plist
此应用程序文件中,我添加了URL Identifier
:com.tryingservice.TryingService
和URL Scheme
:outputHello
。我应该如何设置我的发送者"胶子应用程序 - 使用TryingService
打开URL Scheme
应用程序?
答案 0 :(得分:0)
最后,我按照以下示例对ios进行了自定义服务实现:http://docs.gluonhq.com/samples/gonative/
当这样做并且在学习了一些Objective-C之后,我注意到JoséPereda已经在问题的评论中暗示的BrowserService
- 与我自己的MyService.m
Objective-C文件的相似性
在进一步调查之后,https://bitbucket.org/gluon-oss/charm-down/src/11c36e187921/plugins/plugin-browser/ios/src/main/native/Browser.m?at=default&fileviewer=file-view-default ... if ([[UIApplication sharedApplication] canOpenURL:nsUrl])
中的检查使其无法启动我的自定义网址方案。
通过删除if
中的BrowserService
语句,BrowserService
URL-Scheme
可以启动已注册LAUNCH_URL_KEY
的其他应用。它可以在没有启动safari /默认浏览器的情况下进行。
所以这是一个Gluon应用程序启动另一个Gluon应用程序(用RuntimeArgsService
收听outputHello://<your text here>
)
José也给出了正确的格式:URL-Scheme
。所以我可以将它留空或在/bin/sh
部分之后直接添加(例如,文件的URL)。
但是,由于iOS应用沙盒,导致应用本地存储的网址无法从其他应用中读取:What is Sandbox in ios , Can i Trans data between in one App to Another App in iPhone,if possible how
尽管如下所示,应该可以“打开带有选项的网址”: https://developer.apple.com/documentation/uikit/uiapplicationopenurloptionskey?language=objc