How can I open/send a URL to another app on iOS with a Gluon application?

匿名 (未验证) 提交于 2019-12-03 10:24:21

问题:

I hope to make use of existing functionalities in other apps on iOS in my own app. To my knowledge it should be able to be done with URL custom schemes: https://developer.apple.com/library/content/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Inter-AppCommunication/Inter-AppCommunication.html

Right now in my TryingService gluon application that are acting as a listener, I am using RuntimeArgsService to listen for LAUNCH_URL_KEY. And to my Default-Info.plist file of this application I have added URL Identifier : com.tryingservice.TryingService, and URL Scheme: outputHello. How should I set up my "sender" Gluon application - to open the TryingService application with the URL Scheme?

Right now I am stuck with a functionable URL:

回答1:

In the end I made a custom service implementation to ios by following this example: http://docs.gluonhq.com/samples/gonative/

When doing this and after learning some Objective-C I noticed the BrowserService which already had been hinted by José Pereda in the comments to the question - the similarity to my own MyService.m Objective-C file.

After investigating this futher the check in 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]) - makes it unavailable to launch my custom URL Scheme.

By removing that if- statement in the BrowserService the BrowserService can launch another app that has registered a URL-Scheme. And it does it without launching safari/default browser can be mentioned.

So here is a Gluon app launching another Gluon app (that listens for LAUNCH_URL_KEY with RuntimeArgsService)

The correct format also given by José was: outputHello://<your text here>. So I could both leave it empty or adding (a URL to a file for instance) directly after the URL-Scheme part.

What is Sandbox in ios , Can i Trans data between in one App to Another App in iPhone,if possible how

It should be possible to "open url with options" though as suggested here: https://developer.apple.com/documentation/uikit/uiapplicationopenurloptionskey?language=objc.



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!