Notifications
-
This notification is posted when a YapDatabase instance is deallocated, and has thus closed all references to the underlying sqlite files.
If you intend to delete the sqlite file(s) from disk, it’s recommended you use this notification as a hook to do so.
More info: The YapDatabase class itself is just a retainer for the filepath, blocks, config, etc. And YapDatabaseConnection(s) open a sqlite connection to the database file, and rely on the blocks & config in the parent YapDatabase class. Thus a YapDatabaseConnection instance purposely retains the YapDatabase instance. This means that in order to fully close all references to the underlying sqlite file(s), you need to deallocate YapDatabase and all associated YapDatabaseConnections. While this may be simple in concept, it’s generally difficult to know exactly when all the instances have been deallocated. Especially when there may be a bunch of asynchronous operations going.
Therefore the best approach is to do the following:
- destroy your YapDatabase instance (set it to nil)
- destroy all YapDatabaseConnection instances
- wait for YapDatabaseClosedNotification
- use notification as hook to delete all associated sqlite files from disk
The userInfo dictionary will look like this: @{ YapDatabasePathKey :
, YapDatabasePathWalKey : , YapDatabasePathShmKey : , } This notification is always posted to the main thread.
Declaration
Objective-C
extern NSString *const _Nonnull YapDatabaseClosedNotification
Swift
static let YapDatabaseClosed: NSNotification.Name
-
When the
enableMultiprocessSupport
option is set and aCrossProcessNotifier
extension has been added to the database, this notification is posted following a readwrite transaction where the database was modified in another process.This notification is always posted to the main thread.
Declaration
Objective-C
extern NSString *const _Nonnull YapDatabaseModifiedExternallyNotification
Swift
static let YapDatabaseModifiedExternally: NSNotification.Name
-
This notification is posted following a readwrite transaction where the database was modified.
It is documented in more detail in the wiki article
YapDatabaseModifiedNotification
: https://github.com/yapstudios/YapDatabase/wiki/YapDatabaseModifiedNotificationThe notification object will be the database instance itself. That is, it will be an instance of YapDatabase.
This notification is only posted for internal modifications. When the
enableMultiprocessSupport
option is set, external modification notifications are made available by adding aCrossProcessNotifier
extension to the database, and listening to theYapDatabaseModifiedExternallyNotification
.The userInfo dictionary will look something like this: @{ YapDatabaseSnapshotKey :
, YapDatabaseConnectionKey : , YapDatabaseExtensionsKey : , YapDatabaseCustomKey : , } This notification is always posted to the main thread.
Declaration
Objective-C
extern NSString *const _Nonnull YapDatabaseModifiedNotification
Swift
static let YapDatabaseModified: NSNotification.Name