Note that there are some explanatory texts on larger screens.

plurals
  1. PONSArray refuses to writetofile
    text
    copied!<p>I have an <code>NSArray</code> of objects that wont write to a file. Here is the object header:</p> <pre><code>#import &lt;Foundation/Foundation.h&gt; @interface HSMenuItem : NSObject @property (nonatomic, copy) NSNumber *Id; @property (nonatomic, copy) NSNumber *Meal; @property (nonatomic, copy) NSNumber *DayOfTheWeek; @property (nonatomic, copy) NSString *Body; @property (nonatomic, copy) NSString *StartTime; @property (nonatomic, copy) NSString *EndTime; @property (nonatomic, copy) NSNumber *Seated; - (NSString*) FriendlyMeal; - (NSDate*) Start; - (NSDate*) End; @end </code></pre> <p>I am trying to write the array with <code>- (BOOL)writeToFile:(NSString *)path atomically:(BOOL)flag</code> but it keeps returning <code>NO</code>. Here is the relevant code:</p> <pre><code>NSString* path = [self getPathForCacheFile:identifier]; //identifier is an NSString* argument for this function BOOL b = [arrayToCache writeToFile:path atomically:YES]; MyLog(@"Saved: %@", b ? @"YES":@"NO"); </code></pre> <p>I was searching around and some people were saying it had to do with <code>NSNumber</code>, but <a href="http://developer.apple.com/library/mac/#documentation/General/Conceptual/DevPedia-CocoaCore/PropertyList.html" rel="nofollow">this</a> documentation seems to say that <code>NSNumber</code> is OK to use. What is going on here?</p> <p><strong>Edit</strong></p> <p>I understand whats going on after reading the possible duplicate. This is indeed a duplicate. Please close.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload