Xcode CoreData storage reports an error ., Xcodecoredata
Due to project interface changes, the previous CoreData field needs to be adjusted. Record the error process and solution. The procedure is as follows:
1. Add the fields to be adjusted in the ***. xcdatamodeld file. And update the local model object.
2. My process is to locally store the message in CoreData after receiving the message, and then display the UI (the specific message push and receipt problems have been completed before. I will not explain them here .). Because it is a real machine debugging, after receiving the message push, there is no data. So I want to go to the local sqlite to check whether the message has been stored, so I caught the path and run it into sqlite. The problem arises:
sqlite3 /var/mobile/Containers/Data/Application/29DC033C-817A-4860-911D-0F110F9B38B4/Documents/JiangSuEchat.sqlite
It is okay to execute the preceding statements. However, you cannot obtain. database; or. tables;
The error is as follows:
sqlite> .tablsError: unknown command or invalid arguments: "tabls". Enter ".help" for help
sqlite> .databasesError: unable to open database "/var/mobile/Containers/Data/Application/29DC033C-817A-4860-911D-0F110F9B38B4/Documents/JiangSuEchat.sqlite": unable to open database file
Solution:
Error message: the database file cannot be opened.
I am the second. Because CoreData is obviously stored in the mobile phone during debugging on the real machine, isn't it an obvious error that I use a computer to access the path SQLite on the mobile phone? Therefore, after you change the environment to virtual machine debugging, you can obtain the SQLite file path of the Virtual Machine and perform the preceding steps to query the data.
3. solve the above problems and proceed. Compile the project. No problem.
When you click message center to read the local SQLite message, an error is returned. As follows:
The model used to open the store is incompatible with the one used to create the store
Solution:
Because CoreData was originally used for persistent storage of data values, after the data fields in it were changed. The conflict exists. Follow these steps to solve the problem:
A. clear project file.
B. Delete the app files in the VM.
Specific solution reference: http://stackoverflow.com