現役プログラマのプログラミング教室@岡崎市康生町一隆堂ビル, Android/iOS(Swift/Kotlin)のアプリ開発、デジタル漫画制作を主軸事業としています。

【Realm】のaddNotificationBlock(_:)でValue of type 'Realm' has no member 'removeNotifications'エラー発生

古いソースをビルドしたらRealmCollection.addNotificationBlock(_:)でValue of type ‘Realm’ has no member ‘removeNotifications’と怒られました。
リリースノートをいろいろ調べたところ、Realmのv3.0.0で大幅に変更されていました。cocoapod使っててもこういったとこは結局直さなきゃいけないのはもどかしいですね。

Old APINew API
NotificationToken.stop()NotificationToken.invalidate()
-[RLMNotificationToken stop]-[RLMNotificationToken invalidate]
RealmCollection.addNotificationBlock(_:)RealmCollection.observe(_:)
RLMSyncProgressRLMSyncProgressMode
List.remove(objectAtIndex:)List.remove(at:)
List.swap(_:_:)List.swapAt(_:_:)
SyncPermissionValueSyncPermission
RLMSyncPermissionValueRLMSyncPermission
-[RLMSyncPermission initWithRealmPath:userID:accessLevel]-[RLMSyncPermission initWithRealmPath:identity:accessLevel:]
RLMSyncPermission.userIdRLMSyncPermission.identity
-[RLMRealm addOrUpdateObjectsInArray:]-[RLMRealm addOrUpdateObjects:]

 

    • The following APIs have been removed:

 
 
 

Removed APIReplacement
Object.classNameNone, was erroneously present.
RLMPropertyTypeArrayRLMProperty.array
PropertyType.arrayProperty.array
-[RLMArray sortedResultsUsingProperty:ascending:]-[RLMArray sortedResultsUsingKeyPath:ascending:]
-[RLMCollection sortedResultsUsingProperty:ascending:]-[RLMCollection sortedResultsUsingKeyPath:ascending:]
-[RLMResults sortedResultsUsingProperty:ascending:]-[RLMResults sortedResultsUsingKeyPath:ascending:]
+[RLMSortDescriptor sortDescriptorWithProperty:ascending:]+[RLMSortDescriptor sortDescriptorWithKeyPath:ascending:]
RLMSortDescriptor.propertyRLMSortDescriptor.keyPath
AnyRealmCollection.sorted(byProperty:ascending:)AnyRealmCollection.sorted(byKeyPath:ascending:)
List.sorted(byProperty:ascending:)List.sorted(byKeyPath:ascending:)
LinkingObjects.sorted(byProperty:ascending:)LinkingObjects.sorted(byKeyPath:ascending:)
Results.sorted(byProperty:ascending:)Results.sorted(byKeyPath:ascending:)
SortDescriptor.init(property:ascending:)SortDescriptor.init(keyPath:ascending:)
SortDescriptor.propertySortDescriptor.keyPath
+[RLMRealm migrateRealm:configuration:]+[RLMRealm performMigrationForConfiguration:error:]
RLMSyncManager.disableSSLValidationRLMSyncConfiguration.enableSSLValidation
SyncManager.disableSSLValidationSyncConfiguration.enableSSLValidation
RLMSyncErrorBadResponseRLMSyncAuthErrorBadResponse
RLMSyncPermissionResultsRLMResults
SyncPermissionResultsResults
RLMSyncPermissionChange-[RLMSyncUser applyPermission:callback] / -[RLMSyncUser deletePermission:callback:]
-[RLMSyncUser permissionRealmWithError:]-[RLMSyncUser retrievePermissionsWithCallback:]
RLMSyncPermissionOffer-[RLMSyncUser createOfferForRealmAtURL:accessLevel:expiration:callback:]
RLMSyncPermissionOfferResponse-[RLMSyncUser acceptOfferForToken:callback:]
-[NSError rlmSync_clientResetBlock]-[NSError rlmSync_errorActionToken] / -[NSError rlmSync_clientResetBackedUpRealmPath]
-[NSError rlmSync_deleteRealmBlock]-[NSError rlmSync_errorActionToken]