• 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 object to a file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Saving an object to a file


  • Subject: Saving an object to a file
  • From: Marco Michieli <email@hidden>
  • Date: Mon, 26 Apr 2004 21:14:49 +0200

I'm trying to save a simple string with the following method (actually
I want to save another object that conforms to NSCoding, but I'm just
experimenting with a simple string):


- (IBAction)saveString:(id)sender
{
BOOL result = [NSKeyedArchiver archiveRootObject:[NSString
stringWithString:@"Try to save this string"]
toFile:@"~/Desktop/MyString"];
NSLog(@"saveString result: %d (1=YES, 0=NO)", result);
}


But it doesn't work!
This is the log:


2004-04-26 20:56:50.362 MyApp[532] saveString result: 0 (1=YES, 0=NO)


I don't understand what's wrong with this simple code: I'm probably
missing something obvious, but I can't figure out what...

Thanks for your help

Marco
_______________________________________________
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 object to a file
      • From: Sherm Pendley <email@hidden>
    • Re: Saving an object to a file
      • From: Ondra Cada <email@hidden>
  • Prev by Date: Re: file browsing?
  • Next by Date: end of paragraph in NSTextView
  • Previous by thread: Custom view problems
  • Next by thread: Re: Saving an object to a file
  • Index(es):
    • Date
    • Thread