'RLMException', reason: 'Only 'object' properties can be made optional, and property 'name' is of type 'string'.' `First throw call stack: ( 0 CoreFoundation 0x0000000102e01c65 __exceptionPreprocess + 165 1 libobjc.A.dylib 0x000000010496cbb7 objc_exception_throw + 45 2 Realm 0x00000001024f2fb6 +[RLMObjectSchema schemaForObjectClass:] + 5846 3 Realm 0x000000010257bcb6 +[RLMSchema initialize] + 1862 4 libobjc.A.dylib 0x000000010496d4d6 _class_initialize + 648 5 libobjc.A.dylib 0x00000001049766e1 lookUpImpOrForward + 351 6 libobjc.A.dylib 0x00000001049830d3 objc_msgSend + 211 7 Realm 0x0000000102555770 +[RLMRealm realmWithPath:key:readOnly:inMemory:dynamic:schema:error:] + 4800 8 Realm 0x0000000102554178 +[RLMRealm realmWithPath:readOnly:error:] + 152 9 RealmSwift 0x0000000102887e20 _TTOFCSo8RLMRealmCfMS_FT4pathSS8readOnlySb5errorGVSs33AutoreleasingUnsafeMutablePointerGSqCSo7NSError___GSqS__ + 112 10 RealmSwift 0x0000000102884af9 _TFC10RealmSwift5RealmcfMS0_FT4pathSS_S0_ + 105 11 RealmSwift 0x0000000102884c14 _TFC10RealmSwift5RealmCfMS0_FT4pathSS_S0_ + 100 12 LocoPersist 0x00000001021a030e _TFC11LocoPersist15PersistentStore8queryAllUSs9AnyObject_S_11IPersistent_US2___fGS0_Q_Q0__FT_GSaQ__ + 318 13 LocoPersist 0x00000001021a92c4 _TFFC11LocoPersist15PersistentStore8queryAllUSs9AnyObject_S_11IPersistent_US2___FGS0_Q_Q0__FFGSaQ__T_T_U_FT_T_ + 196 14 LocoPersist 0x00000001021a4527 _TTRXFo__dT__XFdCb__dT__ + 39 15 libdispatch.dylib 0x0000000105e00186 _dispatch_call_block_and_release + 12 16 libdispatch.dylib 0x0000000105e1f614 _dispatch_client_callout + 8 17 libdispatch.dylib 0x0000000105e066a7 _dispatch_queue_drain + 2176 18 libdispatch.dylib 0x0000000105e05cc0 _dispatch_queue_invoke + 235 19 libdispatch.dylib 0x0000000105e093b9 _dispatch_root_queue_drain + 1359 20 libdispatch.dylib 0x0000000105e0ab17 _dispatch_worker_thread3 + 111 21 libsystem_pthread.dylib 0x000000010618c637 _pthread_wqthread + 729 22 libsystem_pthread.dylib 0x000000010618a40d start_wqthread + 13 ) libc++abi.dylib: terminating with uncaught exception of type NSException
It looks like you're trying to define a model with an optional string property, but as the exception states, Realm doesn't support optional string properties, only optional object properties.
You can read more about Realm models here: https://realm.io/docs/swift/latest/#models
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With