Swift访问推送其他ViewController

时间:2017-09-24 10:49:43

标签: swift push-notification push appdelegate

我有FirstViewController和SecondViewController。我试图设置推送通知。我在AppDelegate中添加了以下代码:

    let notificationTypes : UIUserNotificationType = [UIUserNotificationType.Alert, UIUserNotificationType.Badge, UIUserNotificationType.Sound]
    let notificationnSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: nil)
    application.registerForRemoteNotifications()
    application.registerUserNotificationSettings(notificationnSettings)

向用户发出访问FirstViewController上的推送通知的请求。所有用户都对FirstViewController有请求。但我希望他们在另一个ViewControllers上或在具体操作之后有请求。如何让他们在SecondViewController上或在特定操作后收到它?

感谢您的回答。

0 个答案:

没有答案