This chapter summarizes the application-level technologies that are most relevant to developers—that is, that have programmatic interfaces or have an impact on how you write software. It does not describe user-level technologies, such as Exposé, unless there is some aspect of the technology that allows developer involvement.
Application Environments
Application Technologies
Applications are by far the predominant type of software created for Mac OS X, or for any platform. Mac OS X provides numerous environments for developing applications, each of which is suited for specific types of development. The following sections describe each of the primary application environments and offer guidelines to help you choose an environment that is appropriate for your product requirements.
Important: With the transition to Intel-based processors, developers should always create universal binaries for their Carbon, Cocoa, and BSD applications. Java and WebObjects may also need to create universal binaries for bridged code. For information on how to create universal binaries, see Universal Binary Programming Guidelines, Second Edition.
Cocoa is an object-oriented environment designed for rapid application development. It features a sophisticated framework of objects for implementing your application and takes full advantage of graphical tools such as Interface Builder to enable you to create full-featured applications quickly and without a lot of code. The Cocoa environment is especially suited for:
New developers
Developers who prefer working with object-oriented systems
Developers who need to prototype an application quickly
Developers who prefer to leverage the default behavior provided by the Cocoa frameworks so they can focus on the features unique to their application
Python and Ruby developers who want to take advantage of Cocoa features; see Ruby and Python Programming Topics for Mac OS X
The objects in the Cocoa framework handle much of the behavior required of a well-behaved Mac OS X application, including menu management, window management, document management, Open and Save dialogs, and pasteboard (clipboard) behavior. Cocoa’s support for Interface Builder means that you can create most of your user interface (including much of its behavior) graphically rather than programatically. With the addition of Cocoa bindings and Core Data, you can also implement most of the rest of your application graphically as well.
The Cocoa application environment consists of two object-oriented frameworks: Foundation (Foundation.framework)
and the Application Kit (AppKit.framework
). The classes in the Foundation framework implement data management, file access, process notification, memory management, network communication, and other low-level features. The classes in the Application Kit framework implement the user interface layer of an application, including windows, dialogs, controls, menus, and event handling. If you are writing an application, link with the Cocoa framework (Cocoa.framework
), which imports both the Foundation and Application Kit frameworks. If you are writing a Cocoa program that does not have a graphical user interface (a background server, for example), you can link your program solely with the Foundation framework.
Apple’s developer documentation contains a section devoted to Cocoa where you can find conceptual material, reference documentation, and tutorials showing how to write Cocoa applications. If you are a new Cocoa developer, be sure to read Cocoa Fundamentals Guide, which provides an in-depth overview of the development process for Cocoa applications. For information about the development tools, including Interface Builder, see “Mac OS X Developer Tools.”
Based on the original Mac OS 9 interfaces, the Carbon application environment is a set of C APIs used to create full-featured applications for all types of users. The Carbon environment includes support for all of the standard Aqua user interface elements such as windows, controls, and menus. It also provides an extensive infrastructure for handling events, managing data, and using system resources.
The Carbon environment is especially suited for:
Mac OS 9 developers porting their applications to Mac OS X
Developers who are porting commercial applications from other procedural-based systems and want to use as much of their original code as possible
Because the Carbon interfaces are written in C, some developers may find them more familiar than the interfaces in the Cocoa or Java environments. Some C++ developers may also prefer the Carbon environment for development, although C++ code can be integrated seamlessly into Cocoa applications as well.
The Carbon APIs offer you complete control over the features in your application; however, that control comes at the cost of added complexity. Whereas Cocoa provides many features for you automatically, with Carbon you must write the code to support those features yourself. For example, Cocoa applications automatically implement support for default event handlers, the pasteboard, and Apple events, but Carbon developers must add support for these features themselves.
In Mac OS X v10.5 and later, Carbon includes support for integrating Cocoa views into your Carbon applications. After creating the Cocoa view, you can wrap it in an HIView object and embed that object in your window. Once embedded, you use the standard HIView functions to manipulate the view. Wrapped Cocoa views can be used in both composited and noncomposited windows to support views and controls that are available in Cocoa but are not yet available in Carbon. For more information, see Carbon-Cocoa Integration Guide and HIView Reference.
The Carbon application environment comprises several key umbrella frameworks, including the Carbon framework (Carbon.framework
), the Core Services framework (CoreServices.framework
), and the Application Services framework (ApplicationServices.framework
). The Carbon environment also uses the Core Foundation framework (CoreFoundation.framework
) extensively in its implementation.
Apple’s developer documentation contains a section devoted to Carbon, where you can find conceptual material, reference documentation, and tutorials showing how to write applications using Carbon. See Getting Started with Carbon in Carbon Documentation for an overview of the available Carbon documentation.
If you are migrating a Mac OS 9 application to Mac OS X, read Carbon Porting Guide. If you are migrating from Windows, see Porting to Mac OS X from Windows Win32 API. If you are migrating from UNIX, see Porting UNIX/Linux Applications to Mac OS X.
The Java application environment is a runtime environment and set of objects for creating applications that run on multiple platforms. The Java environment is especially suited for:
Experienced Java Platform, Standard Edition/Java SE developers
Developers writing applications to run on multiple platforms
Developers writing Java applets for inclusion in web-based content
Developers familiar with the Swing or AWT toolkits for creating graphical interfaces
The Java application environment lets you develop and execute 100% pure Java applications and applets. This environment conforms to the specifications laid out by the J2SE platform, including those for the Java virtual machine (JVM), making applications created with this environment very portable. You can run them on computers with a different operating system and hardware as long as that system is running a compatible version of the JVM. Java applets should run in any Internet browser that supports them.
Note: Any Mach-O binaries that interact with the JVM must be universal binaries. This includes JNI libraries as well as traditional applications that invoke the JVM. For more information, see Universal Binary Programming Guidelines, Second Edition.
For details on the tools and support provided for Java developers, see “Java Support.”
The AppleScript application environment lets you use AppleScript scripts to quickly create native Mac OS X applications that support the Aqua user interface guidelines. At the heart of this environment is AppleScript Studio, which combines features from AppleScript with Xcode, Interface Builder, and the Cocoa application framework. Using these tools, you can create applications that use AppleScript scripts to control a broad range of Cocoa user-interface objects.
AppleScript Studio has something to offer both to scripters and to those with Cocoa development experience. In addition to AppleScript’s ability to control multiple applications, including parts of the Mac OS itself, you can use it for the following:
Scripters can now create applications with windows, buttons, menus, text fields, tables, and much more. Scripts have full access to user interface objects.
Cocoa developers can take advantage of AppleScript Studio’s enhanced Cocoa scripting support, which can be useful in prototyping, testing, and deploying applications.
For information on how to create applications using AppleScript Studio, see AppleScript Studio Programming Guide.
The WebObjects application environment is a set of tools and object-oriented frameworks targeted at developers creating web services and web-based applications. The WebObjects environment provides a set of flexible tools for creating full-featured web applications. Common uses for this environment include the following:
Creating a web-based interface for dynamic content, including programmatically generated content or content from a database
WebObjects is a separate product sold by Apple. If you are thinking about creating a web storefront or other web-based services, see the information available at http://developer.apple.com/tools/webobjects.
Note: If your WebObjects application includes bridged code in a Mach-O binary, you need to create a universal binary for the Mach-O binary code. For more information, see Universal Binary Programming Guidelines, Second Edition.
The BSD application environment is a set of low-level interfaces for creating shell scripts, command-line tools, and daemons. The BSD environment is especially suited for:
UNIX developers familiar with the FreeBSD and POSIX interfaces
Developers who want to create text-based scripts and tools, rather than tools that have a graphical user interface
Developers who want to provide fundamental system services through the use of daemons or other root processes
The BSD environment is for developers who need to work below the user interface layers provided by Carbon, Cocoa, and WebObjects. Developers can also use this environment to write command-line tools or scripts to perform specific user-level tasks.
X11 extends the BSD environment by adding a set of programming interfaces for creating graphical applications that can run on a variety of UNIX implementations. The X11 environment is especially suited for developers who want to create graphical applications that are also portable across different varieties of UNIX.
The BSD environment is part of the Darwin layer of Mac OS X. For information about Darwin, see Reference Library > Darwin. For more information about X11 development, see http://developer.apple.com/darwin/projects/X11. See also “Information on BSD” for links to additional BSD resources.
Mac OS X includes several technologies that make developing applications easier. These technologies range from utilities for managing your internal data structures to high-level frameworks for burning CDs and DVDs. This section summarizes the application-level technologies that are relevant to developers—that is, that have programmatic interfaces or have an impact on how you write software. It does not describe user-level technologies, such as Exposé, unless there is some aspect of the technology that allows developer involvement.
If you are new to developing Mac OS X software, you should read through this chapter at least once to understand the available technologies and how you might use them in your software. Even experienced developers should revisit this chapter periodically to remind themselves of the available technologies.
Introduced in Mac OS X v10.2, Address Book is technology that encompasses a centralized database for contact and group information, an application for viewing that information, and a programmatic interface for accessing that information in your own programs. The database contains information such as user names, street addresses, email addresses, phone numbers, and distribution lists. Applications that support this type of information can use this data as is or extend it to include application-specific information.
The Address Book framework (AddressBook.framework
) provides your application with a way to access user records and create new ones. Applications that support this framework gain the ability to share user records with other applications, such as the Address Book application and the Apple Mail program. The framework also supports the concept of a “Me” record, which contains information about the currently logged-in user. You can use this record to provide information about the current user automatically; for example, a web browser might use it to populate a web form with the user’s address and phone number.
For more information about this technology, see Address Book Programming Guide for Mac OS X and either Address Book Objective-C Framework Reference or Address Book C Framework Reference.
Introduced in Mac OS X v10.5, the Automator framework (Automator.framework
) adds support for running workflows from your applications. Workflows are products of the Automator application; they string together the actions defined by various applications to perform complex tasks automatically. Unlike AppleScript, which uses a scripting language to implement the same behavior, workflows are constructed visually, requiring no coding or scripting skills to create.
For information about incorporating workflows into your own applications, see Automator Framework Reference.
Introduced in Mac OS X version 10.2, Bonjour is Apple’s implementation of the zero-configuration networking architecture, a powerful system for publishing and discovering services over an IP network. It is relevant to both software and hardware developers.
Incorporating Bonjour support into your software offers a significant improvement to the overall user experience. Rather than prompt the user for the exact name and address of a network device, you can use Bonjour to obtain a list of available devices and let the user choose from that list. For example, you could use it to look for available printing services, which would include any printers or software-based print services, such as a service to create PDF files from print jobs.
Developers of network-based hardware devices are strongly encouraged to support Bonjour. Bonjour alleviates the need for complicated setup instructions for network-based devices such as printers, scanners, RAID servers, and wireless routers. When plugged in, these devices automatically publish the services they offer to clients on the network.
For information on how to incorporate Bonjour services into a Cocoa application, see Bonjour Overview. Bonjour for non-Cocoa applications is described in DNS Service Discovery Programming Guide.
Introduced in Mac OS X v10.5, the Calendar Store framework (CalendarStore.framework
) lets you access iCal data from an Objective-C based application. You can use this framework to fetch user calendars, events, and tasks from the iCal data storage, receive notifications when those objects change, and make changes to the user’s calendar.
For information about using the Calendar Store framework, see [Calendar Store Programming Guide] and Calendar Store Programming Guide.
Introduced in Mac OS X version 10.4, the Core Data framework (CoreData.framework
) manages the data model of a Cocoa-based Model-View-Controller application. Core Data is intended for use in applications where the data model is already highly structured. Instead of defining data structures programmatically, you use the graphical tools in Xcode to build a schema representing your data model. At runtime, instances of your data-model entities are created, managed, and made available through the Core Data framework with little or no coding on your part.
By managing your application’s data model for you, Core Data significantly reduces the amount of code you have to write for your application. Core Data also provides the following features:
Storage of object data in mediums ranging from an XML file to a SQLite database
Management of undo/redo beyond basic text editing
Support for validation of property values
Support for propagating changes and ensuring that the relationships between objects remain consistent
Grouping, filtering, and organizing data in memory and transferring those changes to the user interface through Cocoa bindings
If you are starting to develop a new application, or are planning a significant update to an existing application, you should consider using Core Data. For more information about Core Data, including how to use it in your applications, see Core Data Programming Guide.
Introduced in Mac OS X version 10.2, the Disc Recording framework (DiscRecording.framework
) gives applications the ability to burn and erase CDs and DVDs. This framework was built to satisfy the simple needs of a general application, making it easy to add basic audio and data burning capabilities. At the same time, the framework is flexible enough to support professional CD and DVD mastering applications.
The Disc Recording framework minimizes the amount of work your application must perform to burn optical media. Your application is responsible for specifying the content to be burned but the framework takes over the process of buffering the data, generating the proper file format information, and communicating everything to the burner. In addition, the Disc Recording UI framework (DiscRecordingUI.framework
) provides a complete, standard set of windows for gathering information from the user and displaying the progress of the burn operation.
The Disc Recording framework supports applications built using Carbon and Cocoa. The Disc Recording UI framework currently provides user interface elements for Cocoa applications only.
For more information, see Disc Recording Framework Reference and Disc Recording UI Framework Reference.
Although some applications are extremely simple to use, most require some documentation. Help tags (also called tooltips) and documentation are the best ways to provide users with immediate answers to questions. Help tags provide descriptive information about your user interface quickly and unobtrusively. Documentation provides more detailed solutions to problems, including conceptual material and task-based examples. Both of these elements help the user understand your user interface better and should be a part of every application.
In Mac OS X v10.5 and later, the Spotlight for Help feature makes it easier for users to locate items in complex menu bars. For applications with a Help menu, Mac OS X automatically inserts a special search field menu item at the top of the menu. When the user enters a string in this search field, the system searches the application menus for commands containing the specified string. Moving the mouse over a search result reveals the location of that item in the menus. Developers do not need to add any code to their applications to support this feature.
For information on adding help to a Cocoa application, see Online Help. For information on adding help to a Carbon application, see Apple Help Programming Guide.
Introduced in Mac OS X version 10.2, the Human Interface Toolbox (HIToolbox) provides a modern set of interfaces for creating and managing windows, controls, and menus in Carbon applications. The HIObject model builds on Core Foundation data types to bring a modern, object-oriented approach to the HIToolbox. Although the model is object-oriented, access to the objects is handled by a set of C interfaces. Using the HIToolbox interfaces is recommended for the development of new Carbon applications. Some benefits of this technology include the following:
Drawing is handled natively using Quartz.
A simplified, modern coordinate system is used that is not bounded by the 16-bit space of QuickDraw.
Support for arbitrary views is provided.
Layering of views is handled automatically.
Views can be attached and detached from windows.
Views can be hidden temporarily.
You can use Interface Builder to create your interfaces.
Note: The HIToolbox interfaces are available for creating 32-bit applications only. If you are creating 64-bit applications, you should use Cocoa for your user interface instead.
For reference material and an overview of HIObject and other HIToolbox objects, see the documents in Reference Library > Carbon > Human Interface Toolbox.
Introduced in Mac OS X v10.5, Identity Services encompasses features located in the Collaboration and Core Services frameworks. Identity Services provides a way to manage groups of users on a local system. In addition to standard login accounts, administrative users can now create sharing accounts, which use access control lists to restrict access to designated system or application resources. Sharing accounts do not have an associated home directory on the system and have much more limited privileges than traditional login accounts.
The Collaboration framework (Collaboration.framework
) provides a set of Objective-C classes for displaying sharing account information and other identity-related user interfaces. The classes themselves are wrappers for the C-based identity management routines found in the Core Services framework. Applications can use either the Objective-C or C-based APIs to display information about users and groups and display a panel for selecting users and groups during the editing of access control lists.
For more information about the features of Identity Services and how you use those features in your applications, see Identity Services Programming Guide and Identity Services Reference Collection.
Introduced in Mac OS X version 10.4, the Instant Message framework (InstantMessage.framework
) supports the detection and display of a user’s online presence in applications other than iChat. You can find out the current status of a user connected to an instant messaging service, obtain the user’s custom icon and status message, or obtain a URL to a custom image that indicates the user’s status. You can use this information to display the user’s status in your own application. For example, Mail identifies users who are currently online by tagging that user’s email address with a special icon.
In Mac OS X v10.5, you can use the Instant Message framework to support iChat Theater. This feature gives your application the ability to inject audio or video content into a running iChat conference. The content you provide is then mixed with the user’s live microphone and encoded automatically into the H.264 video format for distribution to conference attendees.
For more information about using the Instant Message framework, see Instant Message Programming Guide.
The Image Capture Services framework (part of Carbon.framework
) is a high-level framework for capturing image data from scanners and digital cameras. The interfaces of the framework are device-independent, so you can use it to gather data from any devices connected to the system. You can get a list of devices, retrieve information about a specific device or image, and retrieve the image data itself.
This framework works in conjunction with the Image Capture Devices framework (ICADevices.framework
) to communicate with imaging hardware. For information on how to use the Image Capture Services framework, see Image Capture Applications Programming Guide.
The Ink feature of Mac OS X provides handwriting recognition for applications that support the Carbon and Cocoa text systems (although the automatic support provided by these text systems is limited to basic recognition). The Ink framework offers several features that you can incorporate into your applications, including the following:
Enable or disable handwriting recognition programmatically.
Access Ink data directly.
Support either deferred recognition or recognition on demand.
Support the direct manipulation of text by means of gestures.
The Ink framework is not limited to developers of end-user applications. Hardware developers can also use it to implement a handwriting recognition solution for a new input device. You might also use the Ink framework to implement your own correction model to provide users with a list of alternate interpretations for handwriting data.
Ink is included as a subframework of Carbon.framework
. For more information on using Ink in Carbon and Cocoa applications, see Using Ink Services in Your Application.
Introduced in Mac OS X v10.5, the Input Method Kit (InputMethodKit.framework
) is an Objective-C framework for building input methods for Chinese, Japanese, and other languages. The Input Method Kit framework lets developers focus exclusively on the development of their input method product's core behavior: the text conversion engine. The framework handles tasks such as connecting to clients, running candidate windows, and several other common tasks that developers would normally have to implement themselves.
For information about its classes, see Input Method Kit Framework Reference.
Keychain Services provides a secure way to store passwords, keys, certificates, and other sensitive information associated with a user. Users often have to manage multiple user IDs and passwords to access various login accounts, servers, secure websites, instant messaging services, and so on. A keychain is an encrypted container that holds passwords for multiple applications and secure services. Access to the keychain is provided through a single master password. Once the keychain is unlocked, Keychain Services–aware applications can access authorized information without bothering the user.
Users with multiple accounts tend to manage those accounts in the following ways:
They create a simple, easily remembered password.
They repeatedly use the same password.
They write the password down where it can easily be found.
If your application handles passwords or sensitive information, you should add support for Keychain Services into your application. For more information on this technology, see Keychain Services Programming Guide.
Introduced in Mac OS X v10.5, the Latent Semantic Mapping framework (LatentSemanticMapping.framework
) contains a Unicode-based API that supports the classification of text and other token-based content into developer-defined categories, based on semantic information latent in the text. Using this API and text samples with known characteristics, you create and train maps, which you can use to analyze and classify arbitrary text. You might use such a map to determine, for example, if an email message is consistent with the user’s interests.
For information about the Latent Semantic Mapping framework, see Latent Semantic Mapping Reference.
Launch Services provides a programmatic way for you to open applications, documents, URLs, or files with a given MIME type in a way similar to the Finder or the Dock. It makes it easy to open documents in the user’s preferred application or open URLs in the user’s favorite web browser. The Launch Services framework also provides interfaces for programmatically registering the document types your application supports.
For information on how to use Launch Services, see Launch Services Programming Guide.
Open Directory is a directory services architecture that provides a centralized way to retrieve information stored in local or network databases. Directory services typically provide access to collected information about users, groups, computers, printers, and other information that exists in a networked environment (although they can also store information about the local system). You use Open Directory in your programs to retrieve information from these local or network databases. For example, if you’re writing an email program, you can use Open Directory to connect to a corporate LDAP server and retrieve the list of individual and group email addresses for the company.
Open Directory uses a plug-in architecture to support a variety of retrieval protocols. Mac OS X provides plug-ins to support LDAPv2, LDAPv3, NetInfo, AppleTalk, SLP, SMB, DNS, Microsoft Active Directory, and Bonjour protocols, among others. You can also write your own plug-ins to support additional protocols.
For more information on this technology, see Open Directory Programming Guide. For information on how to write Open Directory plug-ins, see Open Directory Plug-in Programming Guide.
Introduced in Mac OS X version 10.4, PDF Kit is a Cocoa framework for managing and displaying PDF content directly from your application’s windows and dialogs. Using the classes of the PDF Kit, you can embed a PDFView in your window and give it a PDF file to display. The PDFView class handles the rendering of the PDF content, handles copy-and-paste operations, and provides controls for navigating and setting the zoom level. Other classes let you get the number of pages in a PDF file, find text, manage selections, add annotations, and specify the behavior of some graphical elements, among other actions. Users can also copy selected text in a PDFView to the pasteboard.
Note: Although it is written in Objective-C, you can use the classes of the PDF Kit in both Carbon and Cocoa applications. For information on how to do this, see Carbon-Cocoa Integration Guide.
If you need to display PDF data directly from your application, the PDF Kit is highly recommended. It hides many of the intricacies of the Adobe PDF specification and provides standard PDF viewing controls automatically. The PDF Kit is part of the Quartz framework (Quartz.framework
). For more information, see PDF Kit Programming Guide.
Introduced in Mac OS X v10.5, the Publication Subscription framework (PubSub.framework
) is a new framework that provides high-level support for subscribing to RSS and Atom feeds. You can use the framework to subscribe to podcasts, photocasts, and any other feed-based document. The framework handles all the feed downloads and updates automatically and provides your application with the data from the feed.
For information about the Publication Subscription framework, see Publication Subscription Programming Guide and Publication Subscription Framework Reference.
Introduced in Mac OS X version 10.3, the Search Kit framework lets you search, summarize, and retrieve documents written in most human languages. You can incorporate these capabilities into your application to support fast searching of content managed by your application.
The Search Kit framework is part of the Core Services umbrella framework. The technology is derived from the Apple Information Access Toolkit, which is often referred to by its code name V-Twin. Many system applications, including Spotlight, Finder, Address Book, Apple Help, and Mail use this framework to implement searching.
Search Kit is an evolving technology and as such continues to improve in speed and features. For detailed information about the available features, see Search Kit Reference.
Mac OS X security is built using several open source technologies, including BSD, Common Data Security Architecture (CDSA), and Kerberos. Mac OS X builds on these basic technologies by implementing a layer of high-level services to simplify your security solutions. These high-level services provide a convenient abstraction and make it possible for Apple and third parties to implement new security features without breaking your code. They also make it possible for Apple to combine security technologies in unique ways; for example, Keychain Services provides encrypted data storage with authenticated access using several CDSA technologies.
Mac OS X provides high-level interfaces for the following features:
Mac OS X supports many network-based security standards, including SFTP, S/MIME, and SSH. For a complete list of network protocols, see “Standard Network Protocols.”
For more information about the security architecture and security-related technologies of Mac OS X, see Security Overview. For additional information about CDSA, see the following page of the Open Group’s website: http://www.opengroup.org/security/cdsa.htm.
Mac OS X contains speech technologies that recognize and speak U.S. English. These technologies provide benefits for users and present the possibility of a new paradigm for human-computer interaction.
Speech recognition is the ability for the computer to recognize and respond to a person’s speech. Using speech recognition, users can accomplish tasks comprising multiple steps with one spoken command. Because users control the computer by voice, speech-recognition technology is very important for people with special needs. You can take advantage of the speech engine and API included with Mac OS X to incorporate speech recognition into your applications.
Speech synthesis, also called text-to-speech (TTS), converts text into audible speech. TTS provides a way to deliver information to users without forcing them to shift attention from their current task. For example, the computer could deliver messages such as “Your download is complete” and “You have email from your boss; would you like to read it now?” in the background while you work. TTS is crucial for users with vision or attention disabilities. As with speech recognition, Mac OS X TTS provides an API and several user interface features to help you incorporate speech synthesis into your applications. You can also use speech synthesis to replace digital audio files of spoken text. Eliminating these files can reduce the overall size of your software bundle.
For more information, see Reference Library > User Experience > Speech Technologies.
Introduced in Mac OS X version 10.4, the SQLite library lets you embed a SQL database engine into your applications. Programs that link with the SQLite library can access SQL databases without running a separate RDBMS process. You can create local database files and manage the tables and records in those files. The library is designed for general purpose use but is still optimized to provide fast access to database records.
The SQLite library is located at /usr/lib/libsqlite3.dylib
and the sqlite3.h
header file is in /usr/include
. A command-line interface (sqlite3
) is also available for communicating with SQLite databases using scripts. For details on how to use this command-line interface, see sqlite3
man page.
For more information about using SQLite, go to http://www.sqlite.org.
Introduced in Mac OS X version 10.4, the Sync Services framework gives you access to the data synchronization engine built-in to Mac OS X. You can use this framework to synchronize your application data with system databases, such as those provided by Address Book and iCal. You can also publish your application’s custom data types and make them available for syncing. You might do this to share your application’s data with other applications on the same computer or with applications on multiple computers (through the user’s .Mac account).
With the Sync Services framework, applications can directly initiate the synchronization process. Prior to Mac OS X v10.4, synchronization occurred only through the iSync application. In Mac OS X v10.4 and later, the iSync application still exists but is used to initiate the synchronization process for specific hardware devices, like cell phones.
The Sync Services framework (SyncServices.framework
) provides an Objective-C interface but can be used by both Carbon and Cocoa applications. Applications can use this framework to initiate sync sessions and to push and pull records from the central “truth” database, which the sync engine uses to maintain the master copy of the synchronized records. The system provides predefined schemas for contacts, calendars, bookmarks, and mail notes (see Apple Applications Schema Reference). You can also distribute custom schemas for your own data types and register them with Sync Services.
For more information about using Sync Services in your application, see Sync Services Programming Guide and Sync Services Framework Reference.
Introduced in Mac OS X version 10.3, the Web Kit framework provides an engine for displaying HTML-based content. The Web Kit framework is an umbrella framework containing two subframeworks: Web Core and JavaScript Core. The Web Core framework is based on the kHTML rendering engine, an open source engine for parsing and displaying HTML content. The JavaScript Core framework is based on the KJS open source library for parsing and executing JavaScript code.
Starting with Mac OS X version 10.4, Web Kit also lets you create text views containing editable HTML. The editing support is equivalent to the support available in Cocoa for editing RTF-based content. With this support, you can replace text and manipulate the document text and attributes, including CSS properties. Although it offers many features, the Web Kit editing support is not intended to provide a full-featured editing facility like you might find in professional HTML editing applications. Instead, it is aimed at developers who need to display HTML and handle the basic editing of HTML content.
Also introduced in Mac OS X version 10.4, Web Kit includes support for creating and editing content at the DOM level of an HTML document. You can use this support to navigate DOM nodes and manipulate those nodes and their attributes. You can also use the framework to extract DOM information. For example, you could extract the list of links on a page, modify them, and replace them prior to displaying the document in a web view.
For information on how to use Web Kit from both Carbon and Cocoa applications, see WebKit Objective-C Programming Guide. For information on the classes and protocols in the Web Kit framework, see WebKit Objective-C Framework Reference.
Introduced in Mac OS X v10.5, the Time Machine feature protects user data from accidental loss by automatically backing up data to a different hard drive. Included with this feature is a set of programmer-level functions that you can use to exclude unimportant files from the backup set. For example, you might use these functions to exclude your application’s cache files or any files that can be recreated easily. Excluding these types of files improves backup performance and reduces the amount of space required to back up the user’s system.
For information about the new functions, see Backup Core Reference.
Many businesses provide web services for retrieving data from their websites. The available services cover a wide range of information and include things such as financial data and movie listings. Mac OS X has included support for calling web-based services using Apple events since version 10.1. However, starting with version 10.2, the Web Services Core framework (part of the Core Services umbrella framework) provides support for the invocation of web services using CFNetwork.
For a description of web services and information on how to use the Web Services Core framework, see Web Services Core Programming Guide.
In Mac OS X v10.3, the Darwin layer began including the libXML2
library for parsing XML data. This is an open source library that you can use to parse or write arbitrary XML data quickly. The headers for this library are located in the /usr/include/libxml2
directory.
Several other XML parsing technologies are also included in Mac OS X. For arbitrary XML data, Core Foundation provides a set of functions for parsing the XML content from Carbon or other C-based applications. Cocoa provides several classes to implement XML parsing. If you need to read or write a property list file, you can use either the Core Foundation CFPropertyList functions or the Cocoa NSDictionary object to build a set of collection objects with the XML data.
For information on Core Foundation support for XML parsing, see the documents in Reference Library > Core Foundation > Data Management. For information on parsing XML from a Cocoa application, see Tree-Based XML Programming Guide for Cocoa.
© 2004, 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-10-15)