开发者

NSNumbers in archived array dissappear

开发者 https://www.devze.com 2023-01-03 22:34 出处:网络
Okay I\'ve made an array of NSNumber objects that I\'ve stored into an NSMutableArray. When the game loads it\'s unarchived and retained but all the NSNumber objects are gone. Here\'s my code:

Okay I've made an array of NSNumber objects that I've stored into an NSMutableArray. When the game loads it's unarchived and retained but all the NSNumber objects are gone. Here's my code:

times = [[NSMutableArray alloc] initWithObjects:[[NSNumber alloc] initWithFloat:time],nil];
[NSKeyedArchiver archiveRootObject:times toFile:@"times"];
...

NSMutableArray *newTimes = [[NSKeyedUnarchiver unarchiveObjectWithFile:@"times"] retain];
times = [[NSMutableArray alloc] ini开发者_如何学PythontWithArray:newTimes];
[newTimes release];

Please help.

0

精彩评论

暂无评论...
验证码 换一张
取 消