How to simulate the Local Notification in apple Watch App?

后端 未结 2 1936
半阙折子戏
半阙折子戏 2020-12-08 05:21

I am trying to simulate the local notification view in apple watch simulator. Does any one known how to simulate the local notifications in apple watch ?

I have done

2条回答
  •  遥遥无期
    2020-12-08 06:08

    It is not possible to have a Watch app react to a UILocalNotification in the simulator. However, it is almost identical to reacting to a push notification, except it gets routed through a couple of different methods.

    If you're presenting an actionable notification, your WKUserNotificationInterfaceController subclass would override -didReceiveLocalNotification:withCompletion: instead of -didReceiveRemoteNotification:withCompletion:.

    If your Watch app is getting launched in response to interacting with one of your actionable notifications, then your root WKInterfaceController would implement -handleActionWithIdentifier:forLocalNotification: or -handleActionWithIdentifier:forRemoteNotification:, as appropriate.

    From WatchKit's point-of-view, those are the only distinctions between remote and local notifications.

提交回复
热议问题