美文网首页
【iOS】plist无法写入的原因

【iOS】plist无法写入的原因

作者: haifengmay | 来源:发表于2016-03-14 19:56 被阅读1645次

由于实验室项目的需要将数据存入plist,遇到了无法将数据写入plist的情况,现在将遇到的两种问题以及解决方法。

1>.在iOS中,只允许向沙盒中的plist文件写数据

The problem is you are trying to write to a file in the bundle. The only places you are allowed to write to are the caches directory (not what you want) and the documents directory.(http://stackoverflow.com/questions/32807098/cant-write-data-to-plist-in-ios)

2>.当向沙盒中的plist文件写数据无效时

writeToFile:atomically:

对写入的数据结构应属于以下几种如下:

NSString

NSData

NSDate

NSNumber

NSArray

NSDictionary

其他的数据结构是不被接受的,如 null(http://stackoverflow.com/questions/3010363/nsarray-writetofile-fails)

相关文章

  • 【iOS】plist无法写入的原因

    由于实验室项目的需要将数据存入plist,遇到了无法将数据写入plist的情况,现在将遇到的两种问题以及解决方法。...

  • Plist 写入失败的原因

    1、数据类型只能是NSStringNSDataNSDateNSNumberNSArrayNSDictionary以...

  • iOS plist 文件写入

    一 .plist 文件的读写 //获取路径对象 NSArray*pathArray=NSSearchPathFor...

  • 集成HealthKit,在iOS10上Crash问题

    iOS10之后要在info.plist中加入读取或写入数据权限:

  • plist 文件写入与读取

    plist是iOS中特有的一种文件形式,将数据写入plist文件的实质就是生成plist文件,那什么样的数据才能生...

  • IOS plist 文件写入与读取

    数组写入plist文件(文件储存到cache路径下) 字典写入plist文件 将字典数组写入plist文件

  • iOS数据存储

    iOS数据存储方式 Preference(偏好设置) 写入式(plist(XML属性列表归档)); NSKeyed...

  • pList文件

    pList文件特点: 一,数据写入 写入pList文件的两种方式:手动写入&调方法写入 1,手动写入 2,调用方法...

  • Swift开发对FMDB的二次封装

    iOS开发对于本地持久化数据提供了多种解决途径(归档,写入文件,写入plist,存入本地数据库等等),今天我们就来...

  • CameraRoll 奔溃

    需要添加写入相机权限 iOS 10的权限要求 从iOS10开始,访问相册需要用户授权。你需要在Info.plist...

网友评论

      本文标题:【iOS】plist无法写入的原因

      本文链接:https://www.haomeiwen.com/subject/uobflttx.html