• 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
Saving an alias(AliasHandle/AliasRecord) with NSUserDefaults.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Saving an alias(AliasHandle/AliasRecord) with NSUserDefaults.


  • Subject: Saving an alias(AliasHandle/AliasRecord) with NSUserDefaults.
  • From: Peter Fischer <email@hidden>
  • Date: Mon, 21 Apr 2003 11:10:10 -0400

Hello!-
I'm having a hell of a time with this one, and was hoping someone could help me out. I am attempting to save an AliasHandle off the the NSUserDefaults, in hopes that it can be retrieved when the program is executed at a later time.
I understand taht AliasHandle is a pointer to a pointer to an AliasRecord, and I believe that that is the data that should be stored. When I get the AliasHandle via the newAlias function, I convert it to an Alias handle by doing a double reference, like this:

myAliasRecord = **AliasHandle;

After getting the AliasRecord, I convert it to an NSDataType, and store it in the NSUserDefaults.

When I attempt to read the AliasRecord in after shutting down the program and launch it again, I do everything the same, but in reverse order. I read the data out as an NSDataType, got the byte array, and converted it to an AliasRecord. got the reference to the reference of the AliasRecord to get the AliasHandle.

Whew!, after all this is done, I attempt to get a valid FSRef by calling FSResolveAlias, but, I get an error code of -50. when I look at the data in the debugger, the AliasRecord I store, and the AliasRecord I retrieve look to be the same, but I'm not sure how all this is supposed to work. Is there a better/easier way to do this? Is it even possible to store an Alias in the NSUserDefaults. When I read apple docs online, they suggest using the Resource Manager, should I use this?

Any help would be greatly appreciated. I'm really stuck on this one. Thanks in advance!

--Pete
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Saving an alias(AliasHandle/AliasRecord) with NSUserDefaults.
      • From: Ron Davis <email@hidden>
    • Re: Saving an alias(AliasHandle/AliasRecord) with NSUserDefaults.
      • From: Dan Bernstein <cocoa-dev%email@hidden>
  • Prev by Date: Fwd: SearchKit: AIAT returns!
  • Next by Date: Re: Saving an alias(AliasHandle/AliasRecord) with NSUserDefaults.
  • Previous by thread: Re: SearchKit: AIAT returns!
  • Next by thread: Re: Saving an alias(AliasHandle/AliasRecord) with NSUserDefaults.
  • Index(es):
    • Date
    • Thread