0
我在我的ViewController中有一個UIWebView
。當收到推送通知時,我需要將其重定向到特定頁面。接收推送通知的方法在AppDelegate
中。 那麼我怎樣才能從AppDelegate
訪問ViewController中的UIWebView
?如何在收到推送通知時重定向到Webview中的特定頁面
我在我的ViewController中有一個UIWebView
。當收到推送通知時,我需要將其重定向到特定頁面。接收推送通知的方法在AppDelegate
中。 那麼我怎樣才能從AppDelegate
訪問ViewController中的UIWebView
?如何在收到推送通知時重定向到Webview中的特定頁面
當過一個推送通知收到您可以發佈一個通知像下面
[[NSNotificationCenter defaultCenter] postNotificationName:@"PushNotificationReceived" object:nil];
,並在控制器類,你可以觀察的通知,並做你想做什麼都可以使用nsnotification觀察家
。
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadWebview:) name:@"PushNotificationReceived" object:nil];
這是其中一種方式。