0

我有一个NSArray不会写入文件的对象。这是对象标题:

#import <Foundation/Foundation.h>

@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

我正在尝试用它写数组,- (BOOL)writeToFile:(NSString *)path atomically:(BOOL)flag但它一直在返回NO。以下是相关代码:

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");

我四处寻找,有些人说它与NSNumber,但这个文档似乎说NSNumber可以使用。这里发生了什么?

编辑

在阅读了可能的重复项后,我了解发生了什么。这确实是重复的。请关闭。

4

0 回答 0