Next Page > Hide TOC

CalTask Class Reference

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

Overview

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.

Tasks

Creating and Initializing Tasks

Getting Properties

Properties

For more about Objective-C properties, see “Properties” in The Objective-C 2.0 Programming Language.

completedDate

The task’s completed date.

@property(copy) NSDate *completedDate;

Discussion

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.

Availability
Declared In
CalTask.h

dueDate

The due date and time for this task.

@property(copy) NSDate *dueDate;

Availability
Related Sample Code
Declared In
CalTask.h

isCompleted

YES if this task is completed; otherwise, NO.

@property BOOL isCompleted;

Discussion

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.

Availability
Declared In
CalTask.h

priority

The 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;

Discussion

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.

Availability
Related Sample Code
Declared In
CalTask.h

Class Methods

task

Creates and initializes a newly allocated task object.

+ (id)task

Return Value

A newly created task object.

Availability
Related Sample Code
Declared In
CalTask.h

Constants

CalPriority

Type that describes the priority of a task.

typedef NSUInteger CalPriority;

Availability
Declared In
CalTask.h

Task Priority Constants

The priority of a task.

enum {
   CalPriorityNone     = 0,
   CalPriorityHigh     = 1,
   CalPriorityMedium   = 5,
   CalPriorityLow      = 9
};

Constants
CalPriorityNone

The priority is not set for this task.

Available in Mac OS X v10.5 and later.

Declared in CalTask.h.

CalPriorityHigh

The priority for this task is high.

Available in Mac OS X v10.5 and later.

Declared in CalTask.h.

CalPriorityMedium

The priority for this task is medium.

Available in Mac OS X v10.5 and later.

Declared in CalTask.h.

CalPriorityLow

The priority for this task is low.

Available in Mac OS X v10.5 and later.

Declared in CalTask.h.

Discussion

These constants can be used to set the priority property.

Declared In
CalTask.h

Next Page > Hide TOC


© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-10-31)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.