Bagikan melalui


NSPersistentStoreCoordinator.DidImportUbiquitousContentChangesNotification Properti

Definisi

Konstanta pemberitahuan untuk 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

Nilai Properti

Konstanta NSString, harus digunakan sebagai token untuk NSNotificationCenter.

Atribut

Keterangan

Konstanta ini dapat digunakan dengan NSNotificationCenter untuk mendaftarkan pendengar untuk pemberitahuan ini. Ini adalah NSString alih-alih string, karena nilai-nilai ini dapat digunakan sebagai token di beberapa pustaka asli alih-alih digunakan murni untuk konten string mereka yang sebenarnya. Parameter 'pemberitahuan' ke panggilan balik berisi informasi tambahan yang khusus untuk jenis pemberitahuan.

Jika Anda ingin berlangganan pemberitahuan ini, Anda dapat menggunakan metode .ObserveDidImportUbiquitousContentChanges yang NSPersistentStoreCoordinator.Notificationsmenawarkan akses yang sangat ditik ke parameter pemberitahuan.

Contoh berikut menunjukkan cara menggunakan kelas Pemberitahuan yang ditik dengan kuat, untuk mengeluarkan tebakan dari properti yang tersedia dalam pemberitahuan:

//
// 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 ();
}

Contoh berikut menunjukkan cara menggunakan pemberitahuan dengan DEFAULTCenter API:

// 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);
}

Berlaku untuk