简体   繁体   English

NSArray writeToFile 第一次不工作(但下次工作)

[英]NSArray writeToFile not working first time (but works next time)

I am writing a huge NSArray of NSDictionaries.我正在编写一个巨大的 NSArray 的 NSDictionaries。 The file size when successfully written to a plist is about 549KB.成功写入 plist 时的文件大小约为 549KB。 The thing is, when I start my app, the first time I try to write it, it always returns NO (ie it didn't write), but then the next time it write just fine...Is there any way I can find out exactly what error occurred?问题是,当我启动我的应用程序时,我第一次尝试编写它时,它总是返回 NO(即它没有写),但下一次它写得很好......有什么办法可以找出究竟发生了什么错误? Thanks.谢谢。

Might be your array of dictionaries is empty?可能是您的字典数组是空的? Try to debug your app.尝试调试您的应用程序。

Use NSData - writeToFile:options:error: instead and see what does the returned error (NSError) say.改用NSData - writeToFile:options:error:看看返回的错误 (NSError) 是什么意思。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM