Created
September 4, 2016 22:05
-
-
Save owenzhao/be8eefdaf24d79ea3c72e93ec7842c23 to your computer and use it in GitHub Desktop.
Realm的坑(二)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let bar = Foo() | |
bar.name = "Marry" // ok | |
let realm = try! Realm() | |
try! realm.write { | |
realm.add(bar) | |
bar.name = "Kelly" // ok | |
} | |
bar.name = "Jimmy" // *** Terminating app due to uncaught exception 'RLMException', reason: 'Attempting to modify object outside of a write transaction - call beginWriteTransaction on an RLMRealm instance first.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment