我想弄清楚如何檢查推送通知的有效負載,以確定當用戶從通知中打開應用程序時打開哪個視圖。例如,如果通知顯示「x:test」視圖x將在通知被點擊時打開,並且通知顯示「y:test」視圖將會打開。檢查iOS推送通知有效負載
編輯:我想我應該澄清我不確定的部分。
我有這樣的didFinishLaunchingWithOptions:
UILocalNotification *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if (notification)
{
// check payload then load appropriate view controller
}
如何我會檢查某些文本的有效載荷,以確定相應的視圖控制器加載?
您是否做過任何搜索?在AppDelegate.m中的應用程序didFinishLaunchingWithOptions方法中,您可以閱讀遠程通知,並根據if語句「說」的內容打開正確的視圖。 – Kostis 2014-11-04 20:23:45
https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction.html看來你正在嘗試做類似於http://stackoverflow.com/questions/中的解決方案8685333 /如何管理通知當用戶點擊徽章 – propstm 2014-11-04 20:50:45