我當前的通知名字NSNotificationCenter
是常數,在全球訪問的單定義:在App更新之間更改通知名稱是否安全?
let notificationLeafletImageLongPressed = "com.mycompany.notificationLeafletImageLongPressed"
let notificationLeafletPageChanged = "com.mycompany.notificationLeafletPageChanged"
我想要做的是改變它的東西是這樣的:
enum NotificationKey: String {
case LeafletImageLongPressed
case LeafletPageChanged
}
// Access
print(NotificationKey.LeafletImageLongPressed.rawValue)
這樣,我有編譯器會檢查所有名稱是否真的不同。
我現在有三個問題:
1)據我瞭解設備在App Store中更新的應用程序總是會導致終止(並因此重新開始)的應用程式。對?
2)因此,應該保存更改之間更改通知名稱NSNotificationCenter
。對?
3)目前名稱被定義爲反向dns風格(com.mycompany.notificationName
),但之後他們將只是notificationName
。如果這通常可以做?或者它應該總是反向dns風格? (然後我不能將它更改爲枚舉)
在此先感謝。
由於維克拉姆。我剛剛發現NSDistributedNotificationCenter推薦使用反向dns樣式。 – Darko