RealmでValue of type 'Realm' has no member 'removeNotifications'のエラーが出ます
Realmを使用してみようと思いまして、以下のように記述した際
if token != nil {
realm.removeNotifications(token)
の箇所で
Value of type 'Realm' has no member 'removeNotifications'
と言われます。
どのような事が考えられますでしょうか。
var token: NotificationToken!
@IBAction func startButtonDidTap(sender: AnyObject) {
let realm = try! Realm()
if isUpdating == true {
// Stop
isUpdating = false
locationManager.stopUpdatingLocation()
startButton.setTitle("Start", forState: UIControlState.Normal)
// Remove a previously registered notification
if token != nil {
realm.removeNotifications(token) //Value of type 'Realm' has no member 'removeNotifications'
}
}
else {
// Start
isUpdating = true
locationManager.startUpdatingLocation()
startButton.setTitle("Stop", forState: UIControlState.Normal)
// Add a notification handler for changes
token = realm.addNotificationBlock {
[weak self] notification, realm in
self?.tableView.reloadData()
}
}
}