| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/CalendarStore.framework |
| Availability | Available in Mac OS X v10.5 and later. |
| Companion guide | |
| Declared in | CalTask.h |
| Related sample code |
A CalTask object represents a task added to a calendar in iCal.
You can create a new task using the task method or get existing tasks using the tasksWithPredicate: CalCalendarStore method. If you create a new task then you need to set the inherited calendar property before saving the task using the saveTask:error: CalCalendarStore method.
The tasksWithPredicate: CalCalendarStore method takes an NSPredicate object as the argument so you can build your own queries. Use the taskPredicateWithUncompletedTasksDueBefore:calendars: and taskPredicateWithTasksCompletedSince:calendars: CalCalendarStore methods to create NSPredicate objects for common queries that you can pass to the tasksWithPredicate: method.
Use the properties in this class to set and get information about a task. For example, use the dueDate property to get the due date of a task and the isCompleted property to determine if the task is done. The values of the completedDateand isCompleted properties are interdependent. Read the property descriptions to learn more.
If you retain task objects, you can observe the CalTasksChangedNotification notification to update task objects when they change. Task objects can be added, changed, or deleted locally or externally after you fetch them.
dueDate property
priority property
isCompleted property
completedDate property
For more about Objective-C properties, see “Properties” in The Objective-C Programming Language.
The task’s completed date.
@property(copy) NSDate *completedDate;
If you set completedDate to nil, then isCompleted is set to NO. If you set completedDate to a valid date, then isCompleted is set to YES.
CalTask.hThe due date and time for this task.
@property(copy) NSDate *dueDate;
CalTask.hYES if this task is completed; otherwise, NO.
@property BOOL isCompleted;
If you set isCompleted to YES, then completedDate is set to the current date. If you set isCompleted to NO, then completedDate is set to nil.
CalTask.hThe priority of this task—an integer ranging from 0 to 9 with 0 representing an undefined priority, 1 the highest priority, and 9 the lowest priority.
@property CalPriority priority;
Typically, you use one of the constants described in “Task Priority Constants” to set this property. However, any integer between 0 and 9 are valid values.
CalTask.hCreates and initializes a newly allocated task object.
+ (id)task
A newly created task object.
CalTask.hType that describes the priority of a task.
typedef NSUInteger CalPriority;
CalTask.hThe priority of a task.
enum {
CalPriorityNone = 0,
CalPriorityHigh = 1,
CalPriorityMedium = 5,
CalPriorityLow = 9
};
CalPriorityNoneThe priority is not set for this task.
Available in Mac OS X v10.5 and later.
Declared in CalTask.h.
CalPriorityHighThe priority for this task is high.
Available in Mac OS X v10.5 and later.
Declared in CalTask.h.
CalPriorityMediumThe priority for this task is medium.
Available in Mac OS X v10.5 and later.
Declared in CalTask.h.
CalPriorityLowThe priority for this task is low.
Available in Mac OS X v10.5 and later.
Declared in CalTask.h.
These constants can be used to set the priority property.
CalTask.hLast updated: 2007-10-31