O'Reilly logo

Advanced Mac OS X Programming: The Big Nerd Ranch Guide by Mark Dalrymple

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

File References and Bookmarks

One problem with paths and regular file URLs is that they are fragile in the face of changes to the file system. You can create a path or URL that points to a file, and the user could move that file in the Finder behind your back. If you then try to get metadata or open the file, you could fail because the file is no longer living where you think it is living.

File references

A special kind of URL, called a file reference URL, tracks a file by its ID. This means the reference is still good even if the name or location of the file changes in the file system. Usually this is hidden behind classes like NSDocument, but it can be useful in other contexts aside from document files.

Get a file reference URL from a regular ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required