• 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
Finder style dialog to resolve NSURL bookmark data for missing file?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Finder style dialog to resolve NSURL bookmark data for missing file?


  • Subject: Finder style dialog to resolve NSURL bookmark data for missing file?
  • From: Barry Wark <email@hidden>
  • Date: Tue, 9 Feb 2010 17:45:54 -0800

I am using the new NSURL bookmark data API introduced in OS X 10.6 to
store an "alias" to a file system resource. When I use

+[NSURL URLByResolvingBookmarkData:options:relativeToURL:bookmarkDataIsStale:error:]

to resolve the bookmark data, I get nil if the file no longer exists
(or has been moved to a different volume, etc.). Since I am not
passing NSURLBookmarkResolutionWithoutUI in the bookmark resolution
options, I expected to get a dialog, like that shown by the Finder
when you open an alias file that no longer resolves (i.e. a dialog to
cancel, fix the alias, etc...).

Is there a way to have NSURL automatically prompt to reconnect/resolve
the broken bookmark data?

The bookmark data is created via:

NSError *err
NSData *bookmarkData = [myFileURL
bookmarkDataWithOptions:NSURLBookmarkCreationSuitableForBookmarkFile
                                              includingResourceValuesForKeys:nil

   relativeToURL:nil

                error:&err];

though I get the same outcome if I use 0 for the options instead of
NSURLBookmarkCreationSuitableForBookmarkFile.

I attempt to resolve the same bookmarkData via:

BOOL stale;
NSError *err
NSURL *resolvedURL = [NSURL URLByResolvingBookmarkData:bookmarkData

             options:0

   relativeToURL:nil

bookmarkDataIsStale:&stale

                 error:&err];

Going through the dance of writing the bookmark data to a finder alias
file and then resolving the URL by reading bookmark data from that
file followed by the above method does not produce the desired UI
result either (though opening the alias file in the Finder does
produce the desired UI dialog).

Thanks,
Barry
_______________________________________________

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: NSScrollView
  • Next by Date: Cocoaheads Lake Forest (92630) meeting TOMORROW, Wed 2/10/2010 at 7 pm on whiteboarding a Cocoa Touch application
  • Previous by thread: Re: NSScrollView
  • Next by thread: Cocoaheads Lake Forest (92630) meeting TOMORROW, Wed 2/10/2010 at 7 pm on whiteboarding a Cocoa Touch application
  • Index(es):
    • Date
    • Thread