Why am I getting this error during Realm migration ?: "RLMException", reason: "Invalid value for property"

I am doing wrapping in Realm to convert a string to an array.

Here is my code:

migration.enumerateObjects(Word.className()) { oldObject, newObject in
    var defString = oldObject["string"] as String
    var defArray: [String] = defString.componentsSeparatedByString("/")
    println(defArray) // [variant of 籲|吁[yu4]]
    newObject["array"] = defArray
}

      

When I run the migration, it displays this error: 'RLMException', reason: 'Invalid value for property'

Here is the line that is throwing the exception: /variant of 籲|吁[yu4]/

I tried to remove the brackets and pipe, but that still doesn't work. I'm not sure if it is because of this particular line or if it is associated with some kind of wrong type.

Any suggestions?

+3


source to share


1 answer


Realm does not support storing properties of type Swift Array

. Realm maintains properties RLMArray

whose members must be instances of a subclass RLMObject

.



See the Realm documentation on Models or on RLMArrays for more information.

+2


source







All Articles