Is it possible to attach a file to an ios calender event?

谁都会走 提交于 2019-12-11 02:36:57

问题


In Mac OS it is possible to attach files to a calender event and read that files on the iOS calender.

Question: Is it possible to attach a file to an iOS calender event using the Event Kit framework?

I could not find any hint in the Event Kit documentation


回答1:


The short answer to your question is no - there is no way to attach a file to an iOS Calendar Event.

Why? Because there is no place to put a file. Looking at the EKEvent Class Reference turns up a short list of properties, none of which would work for our goal of adding a file to the event.

If we go up to the super class EKCalendarItem there are also no place to put a file.

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.

However there are some other tricks you might want to try if you are ok only making it look like 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.

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.

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 approved way 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!




回答2:


No, EventKit does not allow you to add an attachment to an EKEvent.




回答3:


The only idea I can offer is to use the notes attribute to keep the file's url.




回答4:


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.




回答5:


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.




回答6:


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.

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.


TO ADD AN ATTACHMENT TO iCAL EVENT:

Open icloud.com in and enter your Apple ID and 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




回答7:


It is possible attaching files to your calendar entries! There is a little application for iPhone and iPad you can use (secretary-app.de).



来源:https://stackoverflow.com/questions/19136780/is-it-possible-to-attach-a-file-to-an-ios-calender-event

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