Is the Core Data database removed from the device while uninstalling the application?

I see an error with Core Data that seems to indicate that the old database is not deleted when the application is removed from my device. Here are the steps I'm taking for this:

  • Remove the application from my device (tap and hold the application, then press the delete button).
  • Install the application from TestFlight .
  • Launch the app. It starts and works fine - until it makes a Core Data request, which will lead to its failure. The root cause of the failure is 'keybar not found in entity <NSSQLEntity Foo id = 3>'

Now, based on the error indicated in step 3, it may seem that the β€œbar” is simply not in Foo and that my problem is related to the Core Data model. However, the same code works on the Simulator without problems and even works fine on the device when connected via Xcode. (I checked several times that the code I use in Xcode to run on the simulator and device matches the code in my TestFlight assemblies.) The problem only exists when installing through TestFlight, but I see no reason to blame TestFlight for my problems.

The same problem arises for another person in my team, following the same steps, so the problem is not specific to my device. The application does not use iCloud, MobileMe or any other synchronization features.

Is all data related to Core Data deleted when the application is removed from my device? Does the behavior of deleting or initializing master data change depending on how the application is installed on the device?

+6
source share
3 answers

All files cannot be deleted from the simulator or in the case of building development on the device. This is because Xcode does not want to reinstall the entire application package from scratch every time it is created during development. Instead of destroying everything, he simply changes what has been changed. This can cause problems, for example. The .xcdatamodel files do not seem to be able to be safely removed from the simulator when the file is deleted from the build target.

However, when you release the assembly on the device, uninstalling the application will delete all the files in the application sandbox, that is, wherever the application can write.

This does not apply to a jailbroken device.

Update:

After reading the updated parent, I would notice that this error:

keypath bar not found in entity <NSSQLEntity Foo id=3> 

... is generated when trying to access a key path that the object does not support. This error almost always occurs inside the query query predicate. A common reason is trying to get the transition from the transition attribute. (Captures performed against the repository and transient attributes, by definition, do not exist in the repository.)

However, I saw that it is this kind of error that occurs with the installation problems described above.

Since this is true:

The problem exists only when installing through TestFlight ...

... I do not think that:

... but I see no reason to blame TestFlight for my problems

... really justified. If everything works, if you are not using TestFlight, then it is reasonable to conclude that TestFlight is causing the problem.

+6
source

Removing an application deletes its sandbox. This includes core data files.

At the risk of offering an obvious suggestion, did you build with the same build configuration? Your build for TestFlight probably uses the Release or AdHoc configuration, your device build probably uses Debug.

+4
source

Did you forcefully close the application before uninstalling it? Before uninstalling the next time, try closing the force.

Also, in the project itself, try cleaning before creating the project, the simulator can detect objects that are not a phone

Found several problems with the same type of errors, but they are all naming errors, and I suppose yours worked for the first time? I have never used testflight when compiling from my laptop, but is there a way to clear the version from this to make sure that the version you are working on is 100% accurate and working?

Try checking these links: one two and three

+2
source

Source: https://habr.com/ru/post/892292/


All Articles