Joshua
Joshua

Reputation: 15500

Removing Objects From The Calendar Store.

I was wondering how you actually remove objects from the Calendar Store, I've looked at the documentation and it only mentions how to add objects but nothing about removing.

How would I remove an object from the calendar store?

Upvotes: 0

Views: 164

Answers (2)

Abizern
Abizern

Reputation: 150575

As Peter points out in his comment; it isn't enough to identify a CalTask just by it's title.

So, how do you uniquely identify a task?

If you look at the documentation for CalTask you will see that it is a sub-class. The super-class has a property which you can use to uniquely identify objects of that super-class, and because CalTask is a sub-class, it too has that property.

Have a look at the code that you used to create those tasks in iCal. When you create each task you can inspect its properties for that property and store it in your model. Then, when you come to delete the tasks from iCal, you can use that property to uniquely identify the task that is to be deleted.

I make no apologies for not being more specific in this answer. You'll need to read the documentation and try and write this for yourself. You'll need to make changes in more than one place in your app:

  1. Change the model so that you can store this unique identifier for the tasks you create.
  2. Change the method that you use to create and add task to the Calendar Store so that you get this identifier and store it in your model.
  3. Make use of this identifier when you are trying to identify the tasks in the Calendar store that you want to delete.

Upvotes: 0

Peter Hosey
Peter Hosey

Reputation: 96323

How would I remove an object from the calender store?

Buy out their stock!

Serious answer: The CalCalendarStore object responds to two messages that remove a calendar item: one for events, the other for tasks. Use whichever one is appropriate to the item you want to remove.

Upvotes: 2

Related Questions