简体   繁体   English

如何确定链接是IOS App中的日历事件,然后将其添加到Calendar?

[英]How do I determine that a link is a calendar event from an IOS App and then add it to Calendar?

I have written an iPhone App that looks at a webpage. 我已经编写了一个可以查看网页的iPhone应用程序。 (I have authorized the App to access Calendar.) One of the links is a calendar link. (我已授权该应用访问日历。)链接之一是日历链接。 When I look at that link with Safari, I get a message. 当我使用Safari浏览该链接时,会收到一条消息。

https://www.dropbox.com/s/opzhxcrg8ye2z4v/Screen%20Shot%202018-11-23%20at%201.17.15%20PM.png?dl=0 https://www.dropbox.com/s/opzhxcrg8ye2z4v/Screen%20Shot%202018-11-23%20at%201.17.15%20PM.png?dl=0

"The website is trying to show you a calendar invite. Do you want to allow it ...". “该网站正试图向您显示日历邀请。您要允许它...”。 I can then add it to my calendar. 然后可以将其添加到我的日历中。 However, when I open that identical link inside my app, my app does not recognize it is a calendar link and then I get options to either Open, Add to Read List, copy ...". 但是,当我在应用程序中打开相同的链接时,我的应用程序无法识别它是日历链接,然后我可以选择打开,添加到阅读列表,复制...”。

https://www.dropbox.com/s/wd7n8n9bz764wih/Screenshot%202018-11-23%2013.20.53.png?dl=0 https://www.dropbox.com/s/wd7n8n9bz764wih/Screenshot%202018-11-23%2013.20.53.png?dl=0

My question is how to get my App to recognize that a link is a calendar link? 我的问题是如何让我的应用程序识别链接是日历链接?

One determines what should be in the file by the suffix and the MIME content type. 通过后缀和MIME内容类型确定文件中应包含的内容。 For icalendars, the suffix is .ics and the MIME content type is text/calendar. 对于icalendar,后缀是.ics,MIME内容类型是text / calendar。 If a link does not have .ics suffix your app can ignore it, if it has a .ics, then it should check the header for the mime-type. 如果链接不带.ics后缀,则您的应用可以忽略它;如果链接具有.ics,则它应检查mime类型的标头。

What is a MIME type? 什么是MIME类型? https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types

What a browser or device actually does with the file depends on what the user has set in the settings. 浏览器或设备对文件的实际作用取决于用户在设置中设置的内容。 EG: a .pdf will topen in the way that the user has told the browser to open .pdf's - either in browser or adobe reader. EG:.pdf将以用户告诉浏览器打开.pdf的方式停止显示-在浏览器或Adobe Reader中。

EG in windows for development purposes, I have specified that calendar links (links with suffix .ics) should be opened in my editor rather than my calendar. 出于开发目的,在Windows中的EG中,我指定日历链接(带有后缀.ics的链接)应在编辑器中而不是日历中打开。

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

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