bug:[NSKeyedUnarchiver initForReadingWithData:]: data is NULL
一,经历
1.问题出在给NSMutableDictionary类型的字典设置内容上.
[_dictRateApp setObject:[NSNumber numberWithBool:NO] forKey:IS_SHOW_ALERT];
2.很纳闷,打印当前字典的时候,key 是正确的, value 也是 Bool 类型的, 可是设置内容的时候就是失败.
3.很可能是字典是不可变字典造成的.追本溯源到字典的内容产生,是从偏好设置里面获取到的.
NSMutableDictionary *dict = (NSMutableDictionary *)[[NSUserDefaults standardUserDefaults]objectForKey:RATE_ON_APP_STORE];
_dictRateApp = dict;
4.感觉没什么问题,参考了stackover 上的一个相似问题,我想起了可能是从偏好设置中取得的字典有问题.
http://stackoverflow.com/questions/16928418/nskeyedunarchiver-initforreadingwithdata-data-is-null
5.然后把字典重新开辟了一段内存,避开了偏好设置返回的字典,就一切 ok 了.
NSMutableDictionary *dictUserDefault = (NSMutableDictionary *)[[NSUserDefaults standardUserDefaults]objectForKey:RATE_ON_APP_STORE];
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary:dictUserDefault];
_dictRateApp = dict;
6.原因可能是偏好设置把可变字典存储成了不可变字典..
bug:[NSKeyedUnarchiver initForReadingWithData:]: data is NULL的更多相关文章
- 关于相机拍照获取图片onActivityResult返回data 为null的问题
调用相机拍摄方法 /** * capture new image */ protected void selectPicFromCamera() { if (!EaseCommonUtils.isSd ...
- MyBatis报错—Type handler was null on parameter mapping for property 'createTime'. It was either not specified and/or could not be found for the javaType (javax.xml.crypto.Data) : jdbcType (null) combina
原因是:在创建实体类的时候吧date类型写成data导致类型不匹配 Type handler was null on parameter mapping for property 'createTim ...
- pytorch bug: for step,data in enumerate(loader)+Connection reset by peer
单GPU跑的程序,而且是在docker中,迭代了几百步后,程序突然崩掉了, 程序停在了 for step,data in enumerate(loader),下面是部分bug信息 Traceback ...
- ssd训练之bug:Invalid JPEG data or crop window, data size 565248
bug信息 tensorflow.python.framework.errors_impl.InvalidArgumentError: Invalid JPEG data or crop window ...
- 关于【【故障公告】数据库服务器 CPU 近 100% 引发的故障(源于 .NET Core 3.0 的一个 bug)】IS NOT NULL测试
测试如图,Core_Users的PhoneNumber可为空,存在索引,记录数1500000+ 增加is not null,查询计划消耗增加了一个0%的筛选器消耗,IO消耗如下一模一样 如果是IS N ...
- 基于iOS 10、realm封装的下载器
代码地址如下:http://www.demodashi.com/demo/11653.html 概要 在决定自己封装一个下载器前,我本以为没有那么复杂,可在实际开发过程中困难重重,再加上iOS10和X ...
- [BS] 小知识点总结-03
1.Autolayout中“constrain to margins” Autolayout中的页面边距的问题ios8以后的UIView增加了layoutMargins属性,在Storyboard/I ...
- iOS - 文件与数据(File & Data)
01 推出系统前的时间处理 --- 实现监听和处理程序退出事件的功能 //视图已经加载过时调用 - (void)viewDidLoad { [super viewDidLoad]; // Do any ...
- 数据存储常用5种方式plist、Preference、NSCoding、SQLite3、Core Data
数据存储 iOS应用数据存储的常用方式 XML属性列表(plist)归档 Preference(偏好设置) NSKeyedArchiver归档(NSCoding) SQLite3 Core Data ...
随机推荐
- gcc【数学几何】
GCC Time Limit: 1000MS Memory limit: 65536K 题目描述 The GNU Compiler Collection (usually shortened to G ...
- C++ 基础 const放在函数末尾的意思
- hdu 4272 2012长春赛区网络赛 dfs暴力 ***
总是T,以为要剪枝,后来发现加个map就行了 #include<cstdio> #include<iostream> #include<algorithm> #in ...
- C可变参数函数 实现
转自:http://blog.csdn.net/weiwangchao_/article/details/4857567 C函数要在程序中用到以下这些宏: void va_start( va_list ...
- How to install the zsh shell in Linux && how to set it as a default login shell
Z shell’s (zsh) popularity has increased in the last years. I have not moved too zsh yet, but I am g ...
- hpunix下11gRac的安装
一.检查环境 1.操作系统版本# uname -a 2.补丁包三大补丁包#swlist -l bundle|grep QPKAPPS#swlist -l bundle|grep QPKBASE#swl ...
- 借助mosquitto“实时”远程监控服务器数据库运行状态
公司的项目还处于开发阶段,我把整个后台服务临时放在阿里云上供前端测试,用的阿里云的ECS云服务器,HTTP请求服务器和数据库服务都安装在一台机子上(穷啊,凑合用),做测试用,配置相当低:单核1Gb.其 ...
- 【SQL Server】数据库是单个用户的 无法顺利进行操作 怎么解决
1.打开数据库 2.新建查询 ,输入以下的SQL 语句 DECLARE @SQL VARCHAR(MAX); SET @SQL='' SELECT @SQL=@SQL+'; KILL '+RTRIM( ...
- lr常用
一.检查点的手动添加 2.关联手工添加:
- 2016.9.1 JavaScript入门之五
1.数据类型:对象:也可以被认为是一个键/值存储,像一个字典.可以取代switch{case:case:}或者if else 例如: function phoneticLookup(val) { va ...