I have an iOS app project in Xcode 12. It is set up as an iPhone-only app that supports iOS 12.4 and later. It uses the CoreData and PDFKit frameworks, as well as two proprietary Swift Packages. All of the source code is Swift.
When I run a debug build of the app, in a simulator or on a physical iPhone device, I always get the following lines at the start of the console log:
2020-11-20 13:14:52.785201-0700 [name of my app] fopen failed for data file: errno = 2 (No such file or directory)
2020-11-20 13:14:52.785318-0700 [name of my app] Errors found! Invalidating cache...
2020-11-20 13:14:52.895737-0700 [name of my app] fopen failed for data file: errno = 2 (No such file or directory)
2020-11-20 13:14:52.895847-0700 [name of my app] Errors found! Invalidating cache...
These lines don’t seem to affect the app’s functionality adversely, but I am wondering what they mean and where they are coming from. I have seen the same lines in console logs in other questions posted to the Internet, but have never seen a question where someone was asking specifically about the meaning of the lines (the questions were always asking about some other problem, and their log just happened to have these lines in it).
2
Answers
Metal is one possible culprit. If you’re importing Metal, try omitting it to see if the error goes away. Also, edit your scheme diagnostics (command<, then click the Diagnostics tab) and deselect Metal API Validation if it’s selected.
Not certain about the cause, but it looks like in some situations Metal tries to read a file from the Caches directory before it exists. In that case, the error should only appear the first time you run your app.
Regardless, I believe that it’s safe to ignore this error, but check your Target Build Settings for MTL_ENABLE_DEBUG_INFO and make sure Release is set to "NO".
If none of this applies to your situation, try stepping through your code while watching your app Caches directory to see which frameworks are using it.
I had the same error when I ran Flutter-generated app on ‘iOS module in Xcode’ from Android Studio SDK. My errors are cleared up after I ran ‘Product’ -> ‘Clean Build Folder’ in Xcode.
My set ups are: Catalina 10.15.7, Android Studio 4.0, Flutter 2.01,and Xcode 12.4.