问题描述:

Thanks for great work.

Recently we were in deep development process, and we just now moved to realm latest version, from 0.98.1 to 1.0.1.

One of the problems is that we had a migration that looked like this:

if (oldSchemaVersion < 2) {

[migration enumerateObjects:MyClass.className block:^(RLMObject *oldObject, RLMObject *newObject) {

newObject[@"property"] = [newObject linkingObjectsOfClass:@"OwnerClass" forProperty:@"myClassInstances"].firstObject;

}];

}

Respectively, OwnerClass has this:

@property RLMArray<MyClass> *myClassInstances;

And MyClass has this:

@property OwnerClass *instance;

So know, as I understand, we should leave the MyClass as is, but change OwnerClass instead of old to this:

@property (readonly) RLMLinkingObjects<MyClass *> *myClassInstances;.

And after we do this, how the migration block should look?

I really struggled to understand how the new structure should look...

Any help is appreciated.

网友答案:

When declaring a property of type RLMLinkingObjects there's no need to include anything related to it in your migration block.

相关阅读:
Top