WWDC rumor roundup: Retina display Macs, iCloud photo sharing, new iOS Maps

  • Apple to show off the future of iOS, Mac at WWDC June 11-15

  • Apple's latest Lion update continues preparations for Retina display Macs

  • Apple releases iOS 5.1.1 with fixes for HDR photos, AirPlay video

  • Free Overnight Shipping on all Macs, lowest prices of the year: Mac Price Guide updated May 13th. (Find the best prices on Macs)
    Tuesday, September 22, 2009

    Inside Snow Leopard's UTI: Apple fixes the Creator Code [Page 3]

    By Daniel Eran Dilger

    Published: 05:00 PM EST (02:00 PM PST)


    UTI definitions

    For example, the "public.html" UTI defines itself as conforming to "public.text," allowing any apps that know how to use text to also access HTML formatted text, even if they never anticipated editing HTML. They could also work with a new vendor-specific UTI such as "com.editmax.htmlplus" that defined itself as conforming to "public.html."

    In turn, "public.text" conforms to both "public.data" and "public.content," so any process that knows how to work with files or content in general terms can also work specifically with HTML files, or any new specialized forms of HTML files invented in the future.

    UTI definitions also include a human readable (and localizable) description of what that file type is; identify the icon that should be used to represent that file; and outline alternative ways to express that file type. For example, the "public.html" UTI associates itself with the legacy "HTML" Type Code and a variety of file extensions that HTML files may use, such as .html, .htm, .shtml, and .shtm. It also associates itself with the MIME type of "text/html," making UTI the uber-type of data typing.

    Developers can make up their own new UTIs, defining them in relation to more general, existing UTIs, without needing to formally register anything. Vendor-specific UTIs use 'reverse DNS' naming just like preference files, preventing different companies from inadvertently using the same label. In the world of file extensions, there's nothing unique about "file.doc," as both WordPerfect and Word used the .doc extension. With UTI, Microsoft uses "com.microsoft.word.doc" to express a unique data type for its files.

    Mac UTI hierarchy


    As a side note, "reverse DNS" is used because DNS itself is backward. Web URLs like "www.apple.com/mac/features.html" go from most specific to least specific (in server name hierarchy), then hit a slash and begin getting more specific (in web server file hierarchy). This is like writing the number 1,234.567 as 4321.567: nutty. So "reverse DNS" is an attempt to fix a big mistake made in web URLs everywhere else that a similar naming hierarchy might be useful. It's too late to fix the web.

    Features of UTI

    So, rather than just defining a file in terms of the app that created it and its general type, developers can now assign their files a UTI that identifies a very specific creator and type, and then inform the system of how that specific new UTI label relates with other more general file types that other apps (and system features) already know how to interact with. Developers can also still indicate that their unique UTI-tagged files should open with their "creator" app, a feature the end user can override via a Finder preference.

    In addition to using UTI to manage what app to use when opening a file in the Finder (via Launch Services) and in determining how to perform copy and paste, drag and drop, and Application Services (via Pasteboard Manager), Mac OS X also uses UTIs within Spotlight importers, Automator Actions, and Quick Look previews, as well as in Navigation Services to narrow down the relevant files presented in open and save dialogs.

    For Launch Services, Apple tells developers to define UTIs for the documents their applications create, and include these within their application. A vendor-specific UTI works like an old fashioned Type and Creator, although developers don't have to register their definitions with Apple in advance. So rather than Adobe registering the "8BIM" creator and "8BPS" type for its Photoshop files, the UTI "com.adobe.photoshop-​image" expressively and uniquely identifies these files as entities that open with Photoshop.

    Other applications can also open Photoshop documents. Conceptually, other apps could even create versions of Photoshop documents that open by default using their own app simply by adding a new UTI that defines itself as a specialized version of the existing "com.adobe.photoshop-​image" UTI. This allows the system to do everything it already knows how to do with Photoshop files (copy and paste, index for search, use in Automator Actions, Quick Look) to new documents defined by the specialized "Photoshop+" UTI. Type/Creator Codes can't do that.

    The Pasteboard's use of UTI was introduced above. It shouldn't be surprising that iPhone 3.0 also uses UTI in its new copy and paste support. If you were wondering why Apple "took so long" to bring that feature to the iPhone, it's because the platform opted for a long term, robust solution rather than a quick and dirty kluge impacted by security issues.

    For Spotlight searching, Apple instructs developers to provide UTI definitions for the types of files their importer plugin can index. The system then uses the most specific and specialized importer available to index files matching that UTI.

    For Automator Actions, developers specify the UTIs their Action knows how to input data from and what UTIs the Action will spit out. Automator Actions are essentially a modular string of Services that are compiled together to copy data from one file or selection, transform it, and spit out a result.

    For Quick Look, plugins specify UTIs for the files they can view. Again, this allows the system to select the most specialized plugin to use in displaying a given file type. In other words, a developer could create a specific plugin for viewing a fancy text UTI (such as XML) with more features (such as color-coded markup tags) than Apple's own basic text Quick Look plugin offers. Quick Look is also an application of UTIs that allows the system itself to open a file for quick viewing without affecting the user's desired default launching app.

    The fix for Creator Code junkies

    UTIs provide a standardized way for defining data anywhere in the system, one that transcends the Type/Creator Code's limited concept of a single app that creates given file types. Developers who complain that Snow Leopard doesn't support Creator Codes need to brush up on UTI, which has been in place for several years now. It offers all the benefits of Creator Codes while enabling lots of other modern new features.

    Users who miss being able to automatically open a file using the app that originally created it can pester their app's developer to get on the ball with UTI. Any application that has been updated since 2005's Tiger, but which does not yet support UTI, has opted not to support an important feature of the Mac platform.

    Everyone else, including many of us who didn't ever understand why the system launched files using a specific app rather than the one we had defined for that given file type, can continue using the Finder's Open With menu, drag and drop app launching, or set a permanent per-item default "creator" app for opening a selection of documents by using the Get Info panel.

    Snow Leopard Server (Developer Reference)


    Daniel Eran Dilger is the author of "Snow Leopard Server (Developer Reference)," a new book from Wiley available now for pre-order at a special price from Amazon.

    Filed under : Software, Mac OS X, iPhone 43 Comments ] 
    Story topics: Snow Leopard   Print ] [ Story Link ] 


    RSS
    RSS
    Mac Connection End of Summer Sale
    MacBook Pro Model
    Apple
    Price
    Discount
    2.4GHz dual 13" MacBook Pro $1,199.00 $1,086.34 $112.66
    2.8GHz dual 13" MacBook Pro $1,499.00 $1,382.19* $116.81
    2.2GHz quad 15" MacBook Pro $1,799.00 $1,629.54* $196.46
    2.4GHz quad 15" MacBook Pro $2,199.00 $1,971.54* $227.46
    2.4GHz quad 17" MacBook Pro $2,499.00 $2,250.39* $248.61
    Early 2011 MacBook Pro Model
    Apple
    Price
    Discount
    2.7GHz dual 13" MacBook Pro $1,499.00 $1,178.59* $320.41
    2.0GHz quad 15" MacBook Pro $1,799.00 $1,503.49* $295.51
    2.2GHz quad 15" MacBook Pro $2,199.00 $1,606.23* $592.77
    2.2GHz quad 17" MacBook Pro $2,499.00 $1,736.78* $762.22
    *Instant 3% AppleInsider Reader Discount Applied With Coupon code:
    APPINSDRMWB32657

    AppleInsider Features
    Hot Forum Topics

    Recent Articles
    AT&T reportedly unlocking iPhones for deployed military personnel
    Analyst cuts AAPL rating on iPhone subsidy backlash, estimates $1B earnings miss
    AT&T to spend $150M on Lumia launch, more than it did with iPhone
    As 'iPad' becomes synonymous with 'tablet,' Apple must protect brand
    Facebook acquires Instagram for $1 billion
    Apple's Tim Cook awarded $378M in 2011, won't see most of it for years
    Apple's next iPhone predicted to have redesigned 'sleek' unibody case
    AT&T's iPhone unlock process accomplished through Apple's iTunes
    Foxconn employee says Apple placing orders for next iPhone to debut in October
    Most of estimated 21M iOS devices in China concentrated in urban areas
    Universal Pictures now available to re-download on Apple's iCloud
    New aerial images of Apple's planned NC fuel cell, solar farms emerge
    UK ad authority moves closer to '4G' iPad investigation
    Apple unlikely to get Samsung device injunction from US court
    Two more top execs exit RIM as company weighs options
    Apple's Ivy Bridge-powered iMacs rumored to debut in June
    Google rumored to launch sub-$250 7-inch tablet in July
    AT&T will allow out-of-contract customers to unlock their iPhone
    Security issue in Facebook, Dropbox iOS apps requires physical access
    HTC profits collapse 70% in face of competition from Apple, Samsung
    Facebook expected to join Apple, Google & Microsoft on Nasdaq
    Users report 3G connection issues with Apple's new iPad
    Samsung announces estimated $40B in revenue, $5B in profit for Q1 2012
    Apple issues second OS X Java update this week
    Qualcomm, Intel provide Apple with source code in patent battle with Samsung
    Apple share price exceeds Google's as its market cap reaches $590 billion
    Intel sinks 'hundreds of millions' of dollars into Ultrabook ad campaign
    Wikipedia joins Apple in migrating from Google Maps to OpenStreetMaps
    Mac shipments slow on absence of new hardware
    Apple may get 80% tax break to build new Texas campus
    Apple may soon begin selling iPad 2 units built in Brazil
    Apple's 'iPanel' called 'far more than a TV,' expected to launch in 2012
    Biographer says Steve Jobs was legitimately infuriated by Android
    Apple exploring face detection to unlock, customize & interact with iOS devices
    Apple interested in wireless power to charge devices on store shelves
    Briefly: iPad refunds; HonHai raising wages; Nokia Lumia estimates
    'Flashback' trojan estimated to have infected 600K Macs worldwide
    Claim construction tilts toward Apple in US patent lawsuit against Samsung
    Apple reportedly 'noodling with' 7.85-inch iPad prototype
    Apple reluctant to settle e-book pricing probe as antitrust specter looms








    AppleInsider RSS Feed
    AppleInsider © 1997-2011
    Please review our Privacy Policy.
    Written/Edited/Compiled by the AppleInsider Staff.