简体   繁体   English

运行时控制台中的核心数据信息和错误

[英]Core Data info & error in console at runtime

I have met the following messages in the console at runtime, and i have no idea why. 我在运行时在控制台中遇到了以下消息,我不知道为什么。 I have searched everywhere and nobody seems to meet this: 我到处搜索,没有人似乎满足这个:

INFO: fetch-response is unable to open the file /Users/userName/Library/Application Support/iPhone Simulator/7.0.3/Applications/964A590B-7131-4BAE-958B-1783BEC193EF/Library/Caches/userName.AppName/fsCachedData/2F1A8708-35A9-491E-9C21-154BA428CA10. 信息:fetch-response无法打开文件/ Users / userName / Library / Application Support / iPhone Simulator / 7.0.3 / Applications / 964A590B-7131-4BAE-958B-1783BEC193EF / Library / Caches / userName.AppName / fsCachedData / 2F1A8708-35A9-491E-9C21-154BA428CA10。 Errno: 2 Errno:2

ERROR: failed to mmap cache data from FS: /Users/userName/Library/Application Support/iPhone Simulator/7.0.3/Applications/964A590B-7131-4BAE-958B-1783BEC193EF/Library/Caches/userName.AppName/fsCachedData/83A968D1-0A2B-4D20-97D5-487A876649DC, errno:22 错误:无法从FS中映射缓存数据:/ Users / userName / Library / Application Support / iPhone Simulator / 7.0.3 / Applications / 964A590B-7131-4BAE-958B-1783BEC193EF / Library / Caches / userName.AppName / fsCachedData / 83A968D1 -0A2B-4D20-97D5-487A876649DC,错误号:22

It does not seem to affect the execution though, but I suppose it is not a good sign. 它似乎并没有影响执行,但我认为这不是一个好兆头。 I am using Core Data with a timer which frequently updates the database from a server. 我正在使用Core Data和一个经常从服务器更新数据库的计时器。 These messages appear synchronously with the updates, but not systematically. 这些消息与更新同步显示,但不是系统地显示。 Only one at the time, the "INFO" or the "ERROR". 当时只有一个,“INFO”或“ERROR”。 Reset Content and Settings in the Simulator did not solve the problem. 在模拟器中重置内容和设置无法解决问题。

Does anyone have any idea about the meaning of these messages? 有没有人知道这些消息的含义?

I experienced this when running on my device with an app I am building. 我在使用我正在构建的应用程序在设备上运行时遇到过这种情况。 It has worked perfect for weeks and then all of a sudden this error. 它已经工作了几个星期,然后突然出现这个错误。 I figured out that it is due to a lack of memory available on the device. 我发现这是因为设备上没有可用的内存。 I use a little app call "System Status" that allows you to view the memory stats and release any old unused memory. 我使用一个小应用程序调用“系统状态”,它允许您查看内存统计信息并释放任何旧的未使用的内存。 I only get this error in Xcode when I have less than 5% available memory on my device. 当我的设备上的可用内存少于5%时,我只在Xcode中收到此错误。 Therefore it cannot load the cache file the app is request, hence the error. 因此,它无法加载应用程序请求的缓存文件,因此错误。 Either close all your multitasking apps and restart your device or get the app and free you memory. 关闭所有多任务应用程序并重新启动设备或获取应用程序并释放内存。

After some testing/debugging (sorry for the delay), I have at least a temporary solution. 经过一些测试/调试(抱歉延迟),我至少有一个临时解决方案。

Because of the multi-threaded saving process of Core Data, I found it a little tricky to identify the exact error location, but it definitely appears that the error occurs when Core Data is trying to save one of the context in the stack (probably the last "root" one). 由于Core Data的多线程保存过程,我发现识别确切的错误位置有点棘手,但是当Core Data试图保存堆栈中的一个上下文时,肯定会出现错误(可能是最后一个“根”一个)。

As each save take a few seconds (without freezing the UI :p) , I figured the error could be generated by a " save overlap ". 由于每次保存需要几秒钟(没有冻结UI:p),我认为可以通过“ 保存重叠 ”生成错误。

So even if I do not have enough to be sure, reducing the save frequency effectively solved my problem: no message anymore in the output. 所以,即使我没有足够的确定, 降低保存频率有效地解决了我的问题:输出中不再有消息。

Now there still is a hitch, and any expert answer would be much appreciated! 现在仍然有一个障碍,任何专家的答案将不胜感激!

Uninstalling the app from the device and installing it again removes this error message. 从设备卸载应用程序并再次安装它会删除此错误消息。

Note that that doesn't fix the problem if you can see this log from earlier versions of your app that is already on your users' devices. 请注意,如果您可以在用户设备上已有的早期版本的应用中看到此日志,则无法解决问题。 It's generally okay to uninstall-install, though, if you're only seeing this during the development phase. 但是,如果您只是在开发阶段看到这一点,那么卸载安装通常是可以的。

For me this happened when my phone ran out of batteries and died as a result. 对我来说,这发生在我的手机耗尽电池并因此而死亡时。 Deleting the app, then restarting my phone, then rebuilding/installing solved the problem. 删除应用程序,然后重新启动手机,然后重建/安装解决了问题。

I ran into this error because my app was stuck in an infinite loop, doing network requests multiple times a second, causing the file to be overwritten before it could be read. 我遇到了这个错误,因为我的应用程序陷入无限循环,每秒多次执行网络请求,导致文件被覆盖,然后才能被读取。

In the situation described in the original post, this might very well be the case. 在原帖中描述的情况中,情况可能就是如此。

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

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