• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSDocumentController openDocumentWithContentsOfURL [Resolved]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDocumentController openDocumentWithContentsOfURL [Resolved]


  • Subject: Re: NSDocumentController openDocumentWithContentsOfURL [Resolved]
  • From: "Mark Munz" <email@hidden>
  • Date: Tue, 5 Aug 2008 00:32:17 -0700

I ended up overriding NSDocumentController's typeForContentsOfURL:
which seems to default to something different than what NSWorkspace
calculates. Instead, I tested for a file path and then call
NSWorkspace's routine on that path.

On Mon, Aug 4, 2008 at 11:49 PM, Mark Munz <email@hidden> wrote:
> Under 10.5, I'm trying to switch over to using UTI's but am seeing
> some weird results:
>
> Given a pathName: if I call NSWorkspaces' typeOfFile:pathName
> error:&error, it returns the proper type (com.apple.rtfd) for an RTFD
> document.
>
> But when I then create an NSURL of the path and pass that URL to
> NSDocumentController's openDocumentWithContentsOfURL, it determines
> the document type to be MSWORD which fails because it tries using
> initWithDocFormat to load the document.
>
> The RTFD document was created in TextEdit. I have an MSWORD type in my
> CFBundleDocumentTypes, but there is no LSItemContentTypes defined for
> it. Here are the two entries for these types.
>
> Is there a reason why openDocumentWithContentsOfURL would somehow
> override the type when compared with NSWorkspaces' typeOfFile? I'm
> trying to understand what it is doing so I can take the right measures
> to correct it.
>
>                <dict>
>                        <key>CFBundleTypeExtensions</key>
>                        <array>
>                                <string>rtfd</string>
>                        </array>
>                        <key>CFBundleTypeIconFile</key>
>                        <string>rtfd.icns</string>
>                        <key>CFBundleTypeName</key>
>                        <string>RTFD</string>
>                        <key>CFBundleTypeOSTypes</key>
>                        <array>
>                                <string>RTFD</string>
>                        </array>
>                        <key>CFBundleTypeRole</key>
>                        <string>Editor</string>
>                        <key>LSItemContentTypes</key>
>                        <array>
>                                <string>com.apple.rtfd</string>
>                        </array>
>                        <key>LSTypeIsPackage</key>
>                        <true/>
>                        <key>NSDocumentClass</key>
>                        <string>RTFDocument</string>
>                        <key>NSPersistentStoreTypeKey</key>
>                        <string>Binary</string>
>                </dict>
>
>                <dict>
>                        <key>CFBundleTypeExtensions</key>
>                        <array>
>                                <string>doc</string>
>                        </array>
>                        <key>CFBundleTypeName</key>
>                        <string>MSWORD</string>
>                        <key>CFBundleTypeOSTypes</key>
>                        <array>
>                                <string>W8BN</string>
>                                <string>W6BN</string>
>                        </array>
>                        <key>CFBundleTypeRole</key>
>                        <string>Viewer</string>
>                        <key>NSDocumentClass</key>
>                        <string>RTFDocument</string>
>                </dict>
>
>
> Thanks.
>
> --
> Mark Munz
> unmarked software
> http://www.unmarked.com/
>



--
Mark Munz
unmarked software
http://www.unmarked.com/
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: CGImageSourceCreateFromURL failed with error -11
  • Next by Date: image type of the AdressBook image data
  • Previous by thread: NSDocumentController openDocumentWithContentsOfURL
  • Next by thread: image type of the AdressBook image data
  • Index(es):
    • Date
    • Thread