是否可以将文件附加到 ios 日历事件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19136780/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is it possible to attach a file to an ios calender event?
提问by Martin Schlagnitweit
In Mac OS it is possible to attach files to a calender event and read that files on the iOS calender.
在 Mac OS 中,可以将文件附加到日历事件并在 iOS 日历上读取该文件。
Question:Is it possible to attach a file to an iOS calender event using the Event Kit framework?
问题:是否可以使用 Event Kit 框架将文件附加到 iOS 日历事件?
I could not find any hint in the Event Kit documentation
我在Event Kit 文档中找不到任何提示
回答by redlightbulb
The short answer to your question is no - there is no way to attach a file to an iOS Calendar Event.
对您的问题的简短回答是否定的 - 无法将文件附加到 iOS 日历事件。
Why? Because there is no place to put a file. Looking at the EKEvent Class Referenceturns up a short list of properties, none of which would work for our goal of adding a file to the event.
为什么?因为没有地方放文件。查看EKEvent 类参考会找到一个简短的属性列表,这些属性都不能满足我们向事件添加文件的目标。
If we go up to the super class EKCalendarItemthere are also no place to put a file.
如果我们上到超类EKCalendarItem也没有地方放置文件。
However, what is it you are trying to do exactly?
但是,您到底要做什么?
If you want to attach a file on one device, say a photo of a cat, and then have that photo sync with the event to another device, you are out of luck. The documentation shows no place you could attach a binary blob to a calendar event.
如果您想在一个设备上附加文件,比如一张猫的照片,然后将该照片与事件同步到另一台设备,那么您就不走运了。该文档显示没有任何地方可以将二进制 blob 附加到日历事件。
However there are some othertricks you might want to try if you are ok only making it looklike a file is attached:
但是,如果您确定只是让它看起来像附加了文件,那么您可能还想尝试一些其他技巧:
EKCalendarItem
has a notes
property that stores an NSString
. You could try something hacky like putting the file as binary data in a string format in there, but I wouldn't as thats silly and could break in all sorts of ways. If you are trying to just store plain text, though, that could work well.
EKCalendarItem
有一个notes
存储NSString
. 你可以尝试一些hacky,比如将文件作为字符串格式的二进制数据放在那里,但我不会那么傻,可能会以各种方式破坏。但是,如果您只想存储纯文本,那可能会很好用。
If you want to link to the file using a URL you can put the URL in the notes
property as another comment suggests, but I would suggest you use a different property - the URL
property.
如果您使用的URL要链接到文件,你可以把网址中的notes
财产作为另一个意见建议,但我会建议你使用一个不同的属性-该URL
属性。
As for how you can give the impression there is a file attached to a calendar event (without actually being able to) I would suggest you look into the magic a good URL scheme can provide.I'm not sure what functionality you are looking for, but a URL scheme is an Apple approvedway to tell your software to show a 'file' (Well, a view in your app that could be a file) by clicking a URL attached to a Calendar Event. You will still have to take care of getting the file onto the device, but that should get you closer to what you want. Good luck!
至于如何给人留下日历事件附加文件的印象(实际上无法),我建议您研究一个好的 URL 方案可以提供的魔法。我不确定您正在寻找什么功能,但 URL 方案是Apple 批准的一种方式,通过单击附加的 URL 告诉您的软件显示“文件”(嗯,您的应用程序中可能是文件的视图)到日历事件。您仍然需要注意将文件放到设备上,但这应该会让您更接近您想要的。祝你好运!
回答by neilco
No, EventKit does not allow you to add an attachment to an EKEvent.
不,EventKit 不允许您向 EKEvent 添加附件。
回答by danh
The only idea I can offer is to use the notes attribute to keep the file's url.
我能提供的唯一想法是使用 notes 属性来保留文件的 url。
回答by Reniagogo
You can add an attachment like a photo in the OS X iCal application. When synced to you iPhone it will be visible in the iOS Calendar App.
您可以在 OS X iCal 应用程序中添加像照片这样的附件。同步到您的 iPhone 后,它将在 iOS 日历应用程序中可见。
回答by Timothy Reid
Save it to Dropbox, copy the link and paste it to the URL box in Calendar Event. It's kind of wonky but it does work. Maybe Apple would do well to creat the functionality to link to photos, docs etc. It should be pretty straight forward.
将其保存到 Dropbox,复制链接并将其粘贴到日历事件中的 URL 框中。这有点不稳定,但确实有效。也许 Apple 会很好地创建链接到照片、文档等的功能。它应该非常简单。
回答by Barry
I don't know if this was untrue at the time this was asked, but now... you certainly CAN add an attachment such as an image. AND...there are actually SEVERAL file types you can add!!
我不知道在问这个问题时这是否属实,但是现在……您当然可以添加附件,例如图像。而且...实际上您可以添加几种文件类型!
I wanted to add my mobile concert ticket & barcode image to the my iCal event so everything for the night would be consolidated.
我想将我的移动音乐会门票和条形码图像添加到我的 iCal 活动中,以便整合当晚的所有内容。
Albeit this is more sort of a work around, because it's not done directly in your iOS iCal, but it's very much possible to do. (and all from your iOS device) You simply go about doing it through your iCloud within a browser.
尽管这更像是一种变通方法,因为它不是直接在您的 iOS iCal 中完成的,但它很有可能做到。(以及所有来自您的 iOS 设备)您只需在浏览器中通过您的 iCloud 进行操作。
TO ADD AN ATTACHMENT TO iCAL EVENT:
添加 iCAL 事件的附件:
Open icloud.com in and enter your Apple ID and PW.
打开 icloud.com 并输入您的 Apple ID 和 PW。
Double-click the event to open it (if it isn't open already). Do any of the following: Click Add File next to “attachments,” locate the file on your computer, then click Choose. Drag the file into your event. ... Click OK. A paper clip icon appears on the event to indicate there's an attachment.
双击事件将其打开(如果尚未打开)。执行以下任一项操作: 点按“附件”旁边的“添加文件”,在您的电脑上找到该文件,然后点按“选择”。将文件拖到您的活动中。... 单击确定。事件上会出现一个回形针图标,表示有附件。
SOURCE: https://support.apple.com/kb/ph12080?locale=en_US
来源:https: //support.apple.com/kb/ph12080?locale =en_US
回答by user3027019
It is possible attaching files to your calendar entries! There is a little application for iPhone and iPad you can use (secretary-app.de).
可以将文件附加到您的日历条目!您可以使用一个适用于 iPhone 和 iPad 的小应用程序 (secretary-app.de)。