如何测试核心数据迁移已经在App Store中的应用程序? [英] How to Test Core Data Migration With an App Already in the App Store?

查看:114
本文介绍了如何测试核心数据迁移已经在App Store中的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前在应用程式商店中有一个应用程式。它使用Core Data作为其持久性机制。我们有一个新版本,准备好了,它有一些架构的变化。具体来说,我们添加了一个新实体,并向现有实体添加了一个新属性。从我的理解和阅读,这是可能发生的最简单的迁移之一。没有字段删除,没有关系可以更改。数据模型由5个实体组成,没有任何关系。

We have an app that is currently in the app store. It uses Core Data as its persistence mechanism. We have a new version ready to go, and it has some schema changes. Specifically, we have added 1 new entity and added a new attribute to an existing entity. From my understanding and reading, this is one of the most simple migrations that can occur. There are no field deletions, and no relationships to change. The data model consists of 5 entities with no relationships at all.

我们对数据模型进行了版本化,并创建了一个.xcmapping模型来处理迁移。我们正在通过添加以下选项来创建PersistentStoreCoordinator来处理迁移:

We have versioned the data model, and created an .xcmappingmodel to handle the migration. We are handling the migration by adding the following options to the creation of the PersistentStoreCoordinator:

NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
                     [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, nil];

目前,我们已使用以下流程对团队中的多个成员进行了测试:

Currently, we have tested successfully with several members of the team using the following process:


  1. 从装置和iTunes中删除应用程式的所有测试版本

  2. 前往应用程式商店并下载

  3. 将新的二进制文件(使用相同的捆绑标识符签名)拖入到新的二进制文件中iTunes和同步

  4. 在设备上加载新版本,验证先前版本中所做的更改是否仍然存在,并确保应用程序不会崩溃

  1. Delete all test versions of the app from the device and from iTunes
  2. Go to the app store and download the current version
  3. Make some changes to the app that will prove the migration was successful
  4. Drag the new binary (signed with the same bundle identifier) into iTunes and sync
  5. Load the new version on the device, verify that the changes made in the previous version are still present, and that the app does not crash

我的问题是这样:
有更容易/更好的方法来测试吗?我们的关注是,一旦应用程序出门,没有其他方法,以确保我们的用户有最好的体验可能。

My question is this: Is there an easier/better way to test this? Our concern is that once the app goes out the door, there is no other way to ensure our users have the best experience possible.

推荐答案

我已为我的应用使用 Core Data 大约7次,从旧模型迁移到新模型。

I've been using Core Data for my app and upgraded about 7 times, migrating from old models to new models.

每当我准备发布下一个版本时,我总是使用模型映射。只要我使每个实体和源模型的属性与目标模型的相应实体和属性匹配,我就没有遇到任何问题。

Whenever, I am prepared to release the next version, I always test migration by using Model Mapping. As long as I made every entity and attribute of source model is matched against corresponding entity and attribute of destination model, I've experienced no problem.

使用自己的项目文件进行测试与测试发布给客户的测试是一样的,所以你不必担心测试是否将旧模型迁移到新模型

换句话说,您的项目包的目标(要存档并提交)与客户下载的目标相同。

In other words, your project bundle's target, which is going to be archived and submitted, is same as what's being downloaded by the customer.

我很自信这是真的,因为我已经用我的应用程序的不同版本测试没有问题。

I'm pretty confident this is the case, since I've done testing with different versions of my app with no problem.

这篇关于如何测试核心数据迁移已经在App Store中的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆