我用這樣的代碼訂閱我的通知:帶NULL對象的NSNotificationCenter.PostNotificationName()不會觸發:錯誤還是設計?
NSNotificationCenter.DefaultCenter.AddObserver("BL_UIIdleTimerFired", delegate {
Console.WriteLine("BaseFolderViewController: idle timer fired");
});
發送通知:
NSNotificationCenter.DefaultCenter.PostNotificationName("BL_UIIdleTimerFired", null);
然而,該通知將只正確如果「anObject」參數的接收PostNotificationName(string sString, object anObject)
不是NULL。
這是設計嗎?我必須傳遞一個對象嗎?或者它是一個錯誤? 我真的不想發送對特定對象的引用。
聽起來很合理。 – Krumelur