Open a specific tab/view when user receives a push notification

丶灬走出姿态 提交于 2019-11-30 07:29:30
Mic Pringle

You can do two things.

One is to check the launchOptions dictionary of the UIApplicationDelegate method

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

to see if the app was launched via a user clicking on a notification. If so, then in that method you can push the appropriate view controller onto the stack, just as you would normally with in-app usage.

If the app is already open, but in the background then the same theory applies but instead use the UIApplicationDelegate method

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo

See this link for information on handling incoming notifications.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!