I am trying to write an application in OS X using the Realm database. In my program, I need to wait until the recording in Realm is complete, and then call the new controller. After much research, it seems that using Realm, built in the notification center, would be appropriate. According to Realm documentation, the format should work as follows
let token = realm.addNotificationBlock { notification, realm in viewController.updateUI() }
I understand this is a quick close, but I'm not sure how to use it. If I changed the code to this
let token = realm.addNotificationBlock { notification, realm in println("The realm is complete") }
Will it print on my debug screen when recording is completed? Or easier, how can I execute the code only after receiving a notification?
If I put the above code in my application, I don’t see my line on the debug screen, I see the following:
2015-07-31 16: 08: 17.138 Therapy Invoice [27979: 2208171] RLMNotificationToken released without unregistering the notification. You should hold on to the RLMNotificationToken returned from addNotificationBlock and call removeNotification: when you no longer want to receive RLMRealm notifications.
source share