• 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
NSArray saveToFile: atomically does not work
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSArray saveToFile: atomically does not work


  • Subject: NSArray saveToFile: atomically does not work
  • From: Bruce Truax <email@hidden>
  • Date: Tue, 04 Jan 2005 11:56:27 -0500

I have an NSMutableArray *variableArray.  This array is made of of
ACVariable objects defined as follows:

@interface ACVariable : NSObject {
    NSString *variable;
    NSNumber *all;
    NSNumber *surface;
    NSString *lowLimit;
    NSString *highLimit;
    NSString *weight;
    NSString *derivativeIncrement;

}

+ (NSArray *)variableList;
- (NSString *)variable;
- (void)setVariable:(NSString *)aVariable;
- (NSNumber *)all;
- (void)setAll:(NSNumber *)anAll;
- (NSNumber *)surface;
- (void)setSurface:(NSNumber *)aSurface;
- (NSString *)lowLimit;
- (void)setLowLimit:(NSString *)aLowLimit;
- (NSString *)highLimit;
- (void)setHighLimit:(NSString *)aHighLimit;
- (NSString *)weight;
- (void)setWeight:(NSString *)aWeight;
- (NSString *)derivativeIncrement;
- (void)setDerivativeIncrement:(NSString *)aDerivativeIncrement;

@end


When I try to save this array using writeToFile: atomically: as in the code
snippet below it always fails.

    if([variableArray writeToFile:@"/Users/bruce/Desktop/variables"
                       atomically:YES]){
        NSLog(@"Variable File saved successfully");
    }else{
        NSLog(@"Unable to save variable file");
    }


According to the documentation for writeToFile: atomically: for this to work
all of the receiver's contents must be property list objects, and I thought
that NSNumber and NSStrings were both property list objects (at least if you
go into the Propery list editor, you can add children which are numbers and
strings).  The documentation then parenthetically lists NSString, NSData,
NSArray and NSDictionary as the allowable objects.  Is it really true that
you cannot use writeToFile: atomically if you have anything other than these
four types of objects in your array?

Bruce

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSArray saveToFile: atomically does not work
      • From: Shawn Erickson <email@hidden>
    • Re: NSArray saveToFile: atomically does not work
      • From: Guy English <email@hidden>
  • Prev by Date: Re: statically linking one of my framework to a foundation tool
  • Next by Date: Re: NSBox addSubview positioning
  • Previous by thread: Re: statically linking one of my framework to a foundation tool
  • Next by thread: Re: NSArray saveToFile: atomically does not work
  • Index(es):
    • Date
    • Thread