简体   繁体   English

如何从网站上的链接打开本机iOS应用程序(日历,笔记...)?

[英]How to open native iOS app (calendar, notes…) from a link on website?

Is it possible to open native iOS app, eg calendar or notes, from an HTML link which is in website? 是否可以从网站上的HTML链接打开原生iOS应用程序,例如日历或笔记? I tried to find an example but I couldn't. 我试图找到一个例子,但我不能。 I ran into these URL schemes but I don't know how to use them and what's the URL scheme for calendar or notes. 我遇到了这些URL方案,但我不知道如何使用它们以及日历或备注的URL方案是什么。 Is it possible just to do something like this: 有可能只做这样的事情:

<a href="calendar://something here?">Click me!</a> 

Is it possible to do it only with HTML or is JavaScript needed? 是否可以仅使用HTML或需要JavaScript?

如果您正在寻找URL架构,iPhone日历是:CALSHOW:

Yes you can very well possible to do that. 是的,你很可能做到这一点。 You're right in placing the link like this: 你正好放置这样的链接:

<a href="calendar://">Click me!</a>

Now go to your iOS app's info.plist file. 现在转到iOS应用的info.plist文件。 In that add the following tags: 在那里添加以下标签:

<key>CFBundleURLTypes</key>
<array>
<dict>
    <key>CFBundleURLName</key>
    <string>com.companyname.appname</string>
    <key>CFBundleURLSchemes</key>
    <array>
        <string>calendar</string>
    </array>
</dict>
</array>

Save the plist file and exit it. 保存plist文件并退出。 After this when you open the web page in Safari browser of your iOS device and click on the link, your iOS app will invoke. 在此之后,当您在iOS设备的Safari浏览器中打开网页并单击该链接时,您的iOS应用程序将会调用。 I hope it helps! 我希望它有所帮助!

Calendar and Notes do not have URL schemes. 日历和Notes没有URL方案。 Apple provides a reference for those of their apps that do use URL schemes here: Apple为这些使用URL方案的应用提供了参考:

https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/Introduction/Introduction.html https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/Introduction/Introduction.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM