写一个大的NSDictionary来文件崩溃

时间:2017-12-22 08:36:54

标签: ios objective-c dictionary plist writetofile

当我使用[dic writeToFile:path atomically:YES];时,我收到了这样的崩溃:

0   CoreFoundation  __exceptionPreprocess (in CoreFoundation) + 124
1   libobjc.A.dylib objc_exception_throw (in libobjc.A.dylib) + 56
2   Foundation  _NSErrnoMessage (in Foundation) + 0
3   CoreFoundation  __CFSafelyReallocate (in CoreFoundation) + 136
4   CoreFoundation  __CFDataGrow (in CoreFoundation) + 412
5   CoreFoundation  CFDataReplaceBytes (in CoreFoundation) + 440
6   CoreFoundation  _plistAppendCharacters (in CoreFoundation) + 180
7   CoreFoundation  _CFAppendXML0 (in CoreFoundation) + 2228
8   CoreFoundation  _CFAppendXML0 (in CoreFoundation) + 2720
9   CoreFoundation  _CFAppendXML0 (in CoreFoundation) + 2720
10  CoreFoundation  _CFPropertyListCreateXMLData (in CoreFoundation) + 216
11  CoreFoundation  CFPropertyListCreateData (in CoreFoundation) + 152
12  Foundation  +[NSPropertyListSerialization dataWithPropertyList:format:options:error:] (in Foundation) + 48
13  Foundation  -[NSDictionary(NSDictionary) writeToFile:atomically:] (in Foundation) + 180

我认为NSDictionary包含更多项目,当malloc内存失败时。 如何写一个大的字典文件?或其他最好的方式? 那么有人可以帮助我取悦我做错了什么吗?

0 个答案:

没有答案