我正在测试我的应用程序使用Push Notifs。它整天运作良好,突然停了下来。设置完全没有变化。经过多次调试后,我发现函数didRegisterForRemoteNotificationsWithDeviceToken
永远不再被调用了。我在这个函数上设置了一个断点,当应用程序启动时,它根本没有被调用,或者我重新安装了应用程序。如果我想允许push notifs,我会得到动作表,但之后从未调用过委托。
settings = UIUserNotificationSettings(forTypes: [.Alert, .Badge, .Sound], categories: nil)
UIApplication.sharedApplication().registerUserNotificationSettings(settings!)
UIApplication.sharedApplication().registerForRemoteNotifications()