Partager via


NSPersistentStoreCoordinator.DidImportUbiquitousContentChangesNotification Propriété

Définition

Constante de notification pour DidImportUbiquitousContentChanges

[Foundation.Advice("Use NSPersistentStoreCoordinator.Notifications.ObserveDidImportUbiquitousContentChanges helper method instead.")]
[Foundation.Field("NSPersistentStoreDidImportUbiquitousContentChangesNotification", "CoreData")]
[ObjCRuntime.Deprecated(ObjCRuntime.PlatformName.iOS, 10, 0, ObjCRuntime.PlatformArchitecture.All, "Please see the release notes and Core Data documentation.")]
[ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.WatchOS, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.TvOS, ObjCRuntime.PlatformArchitecture.All, null)]
public static Foundation.NSString DidImportUbiquitousContentChangesNotification { [ObjCRuntime.Deprecated(ObjCRuntime.PlatformName.iOS, 10, 0, ObjCRuntime.PlatformArchitecture.All, "Please see the release notes and Core Data documentation.")] [ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.WatchOS, ObjCRuntime.PlatformArchitecture.All, null)] [ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.TvOS, ObjCRuntime.PlatformArchitecture.All, null)] get; }
member this.DidImportUbiquitousContentChangesNotification : Foundation.NSString

Valeur de propriété

La constante NSString doit être utilisée comme jeton pour NSNotificationCenter.

Attributs

Remarques

Cette constante peut être utilisée avec pour NSNotificationCenter inscrire un écouteur pour cette notification. Il s’agit d’un NSString au lieu d’une chaîne, car ces valeurs peuvent être utilisées comme jetons dans certaines bibliothèques natives au lieu d’être utilisées uniquement pour leur contenu de chaîne réel. Le paramètre « notification » du rappel contient des informations supplémentaires spécifiques au type de notification.

Si vous souhaitez vous abonner à cette notification, vous pouvez utiliser la méthode pratique NSPersistentStoreCoordinator.Notifications.ObserveDidImportUbiquitousContentChanges qui offre un accès fortement typé aux paramètres de la notification.

L’exemple suivant montre comment utiliser la classe Notifications fortement typée pour extraire les suppositions des propriétés disponibles dans la notification :

//
// Lambda style
//

// listening
notification = NSPersistentStoreCoordinator.Notifications.ObserveDidImportUbiquitousContentChanges ((sender, args) => {
    /* Access strongly typed args */
    Console.WriteLine ("Notification: {0}", args.Notification);
});

// To stop listening:
notification.Dispose ();

//
// Method style
//
NSObject notification;
void Callback (object sender, Foundation.NSNotificationEventArgs args)
{
    // Access strongly typed args
    Console.WriteLine ("Notification: {0}", args.Notification);
}

void Setup ()
{
    notification = NSPersistentStoreCoordinator.Notifications.ObserveDidImportUbiquitousContentChanges (Callback);
}

void Teardown ()
{
    notification.Dispose ();
}

L’exemple suivant montre comment utiliser la notification avec l’API DefaultCenter :

// Lambda style
NSNotificationCenter.DefaultCenter.AddObserver (
        NSPersistentStoreCoordinator.DidImportUbiquitousContentChangesNotification, (notification) => {Console.WriteLine ("Received the notification NSPersistentStoreCoordinator", notification); }


// Method style
void Callback (NSNotification notification)
{
    Console.WriteLine ("Received a notification NSPersistentStoreCoordinator", notification);
}

void Setup ()
{
    NSNotificationCenter.DefaultCenter.AddObserver (NSPersistentStoreCoordinator.DidImportUbiquitousContentChangesNotification, Callback);
}

S’applique à