nskbrown eyed girlsunarchiver 有延迟吗

Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
*** -[NSKeyedUnarchiver initForReadingWithData:]: data is NULL
I'm creating my first Iphone app, and I'm triyng to save its data when the user asks it.
I have a GameManager class :
@interface GameManager : NSObject &NSCoding&
where I wrote the following methods :
- (void) encodeWithCoder: (NSCoder *)coder {
NSLog(@&Encoding gameManager&);
[coder encodeInt: i_nbSidePots forKey:@&i_nbSidePots&];
[coder encodeInt: i_currentResolvedSidePot forKey:@&i_currentResolvedSidePot&];
-(id) initWithCoder: (NSCoder *) coder
NSLog(@&GameManager InitWith coder&);
if (self = [super init]) {
i_nbSidePots = [coder decodeIntForKey:@&i_nbSidePots& ];
i_currentResolvedSidePot = [coder decodeIntForKey:@&i_currentResolvedSidePot& ];
Then, in my main class, wich contains a GameManager
instance, I'm doing this :
- (void) saveDataToDisk {
NSLog(@&Saving game&);
NSMutableData *data = [NSMutableData data];
NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data];
[archiver setOutputFormat:NSPropertyListXMLFormat_v1_0];
[archiver encodeObject:myGameManager forKey:@&Toto&];
[archiver finishEncoding];
[data writeToFile:[self pathForDataFile] atomically:YES];
NSLog(@&Save OK&);
- (void) loadDataFromDisk {
NSLog(@&Load datafromdisk&);
NSMutableData *data = [NSData dataWithContentsOfFile:[self pathForDataFile]];
NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:data];
myGameManager = [unarchiver decodeObjectForKey:@&Toto&];
[unarchiver finishDecoding];
When I'm clicking the save button, it seems to work : I can see
Saving game
Encoding GameManager
in my log.
But when I'm trying to load, it's not working :
Load datafromdisk
*** -[NSKeyedUnarchiver initForReadingWithData:]: data is NULL
Have you got an idea of what's wrong with my code ?
Thanks for your help !
Post edited by R40ul on July 20100
Any idea ?
I'm stuck for several days, and I'm pretty sure that this problem is easy to solve, but I do not manage to find some working code on internet.
If you don't know where my problem come from could you please give me an other method to save my GameManager class ?&&&&&&&&iPhone开发数据持久化总结之第3篇—归档(NSKeyedArchiver、NSKeyedUnarchiver)
正在努力加载播放器,请稍等…
正在努力加载播放器
大小:72.00KB&&所需金币:50
&& & 金币不足怎么办?
下载量:-次 浏览量:211次
贡献时间: 16:00:00
文档标签:
已有-位用户参与评分
同类热门文档
你可能喜欢
看过这篇文档的还看过
阅读:538&&下载:27
阅读:312&&下载:24
阅读:196&&下载:19
阅读:219&&下载:4
阅读:109&&下载:2
阅读:887&&下载:1
阅读:111&&下载:0
阅读:163&&下载:0
阅读:167&&下载:0
阅读:63&&下载:0
该用户的其他文档
所需财富值:
50文件大小:72.00KB
您当前剩余财富值:&&
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
举报该文档侵犯版权。
例: /help.shtml君,已阅读到文档的结尾了呢~~
扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
使用NSKeyedUnarchiver解压数据如何防止crash
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='/DocinViewer-4.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口君,已阅读到文档的结尾了呢~~
使用NSKeyedUnarchiver解压数据如何防止crash(可编辑),nskeyedunarchiver,the unarchiver,unarchiver,unarchiver for mac,mac unarchiver,mac the unarchiver,izip unarchiver,theunarchiver,he unarchiver
扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
使用NSKeyedUnarchiver解压数据如何防止crash(可编辑)
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='/DocinViewer-4.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口}

我要回帖

更多关于 the black eyed peas 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信