Primary key property 'name' does not exist on object 'RealmSwiftPermissionRole'

Developers of Realm have started working on Xcode 11 compatibility. From that page...

Using Realm with Xcode betas requires building from source, and typically will require using dev branches rather than releases.

Carthage

github "realm/realm-cocoa" "tg/xcode-11-b1"

DEVELOPER_DIR=/Applications/Xcode-beta.app/Contents/Developer carthage bootstrap -no-use-binaries

CocoaPods

pod 'Realm', git: 'https://github.com/realm/realm-cocoa.git', branch: 'tg/xcode-11-b1', submodules: true

pod 'RealmSwift', git: 'https://github.com/realm/realm-cocoa.git', branch: 'tg/xcode-11-b1', submodules: true

Explicitly including the Realm pod as a dependency is required as otherwise it'll try to use the latest release of the obj-c part.

Note that last sentence. You must include the Realm pod as a dependency or it'll use the non-beta version and it won't work.


I had run into the same issue with RealmSwift 4.3.1, the problem was I forgot to mark the property as @objc

@objc dynamic var id = ""

There's an issue with iOS 13 and Xcode 11 which may cause this problem. All String properties of Realm classes with a default String value set are disregarded somehow. You can fix this by updating to the latest version (currently 3.20.0) and then on Xcode: Product -> Clean Build Folder.

If you're using cocoa-pods:

Open your project's Podfile, and replace RealmSwift line with:

pod 'RealmSwift', '~> 4.4.1'

Then, open terminal on the project's folder and:

pod repo update
pod install

Hope that helps.

Tags:

Xcode

Realm