How long can the main data migration run?

I saw successful migrations of the baseline data of my 4Gb database to my iPad when the application started in a few minutes. And now, all of a sudden, some users report crashes after installing the new version, and the application pops up with: failed to start with a time error.

I just checked again, restoring the old database, and I am sure that the migration of the master data can take more than 10 seconds.

But other people are worried that this should not, and try to take it into the background or, at least, from the startup loop during startup:

IPhone application launch time and master data transfer

Could this have anything with other conditions, for example? connected to a power source? Or does the battery level exceed 50%?

Update: I reproduced the failure by simply running the application on the device (disconnected from the network) instead of debugging. Then I tried to run the application on a device with a USB connection: Crash. Then they launched the application through the debugger: There are no crashes (and the migration took about 4 minutes.)

Additional information: I have only corporate users (about 75 of them), and they all have a 4.5Gb database. Some users have no problems updating, and some have. With a successful upgrade, everything will take minutes. Accidents always occur after 20 seconds. (And they continue to crash if you try again on these devices).

I went for advice on moving migration from the loop cycle, but I'm still wondering why the old method works on some devices and not on others. All users are on iOS 7.

+6
source share
3 answers

This is a common startup problem. Transferring master data can take any amount of time from 0 to N, depending on the complexity of the model and the amount of data and type of migration.

Ideally, you should not create your Core Data stack in the -applicationDidFinish... method, and migration is one of the reasons.

My recommendation is to rework your launch so that you display something until the stack is initialized. It can only be the default image in the view. Then, when the original Core stack is initialized, you can switch to the full controller stack.

I would also recommend doing this a little further so that you can tell the user that the migration process is in progress, and I would add a migration in the background so that you can update the interface during the migration.

Finally, if you are doing heavy migration, I would look at facilitating migration. Easy migration is much faster, as well as other benefits.

+6
source

If you look at the crash log, you will most likely say that the application was killed because there was too much time to run. The tracking process kills applications that take too long to run -> 20 seconds, I think. This is due to the fact that the main data transfer process was performed during the launch of the application.

I would recommend that you manually start the migration in the background. The next new book, Master Data, contains code and explanations on how to migrate the source background.

http://www.amazon.com/gp/aw/d/0321905768

+1
source

This is not a rule that does not trigger migration in the background thread, but it is a suggestion because if you start the background thread and run the application, it is not guaranteed that your main data stack will not touch.

You can perform this migration from didFinishLaunching, but make sure the stack is not touching. You can handle this with some verification, for example, placing a viewController with an application update message that prevents the user from doing anything, and at the same time you can transfer the background transfer. When the migration process is complete, you can simply discard the viewController leading the user to the home viewController .

When your application runs on the iOS platform, you cannot guarantee everything, for example, for a while, if the native applications require more memory, then the memory will disconnect from the quota of your application and can receive some wired killings.

0
source

All Articles