- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
if UIApplication.sharedApplication().isRegisteredForRemoteNotifications() == true {
println("Yes, allowed")
println(UIApplication.sharedApplication().isRegisteredForRemoteNotifications())
} else {
//ignore
return
}
当我转到设置以完全关闭通知然后返回应用程序时,该应用程序仍然打印 true
, allowed。
我似乎无法让它触发 false,即使在应用程序卸载/重新安装之后也是如此。
最佳答案
我为 Swift 3 做了一个扩展
extension UIApplication {
func remoteNotificationsEnabled() -> Bool {
var notificationsEnabled = false
if let userNotificationSettings = currentUserNotificationSettings {
notificationsEnabled = userNotificationSettings.types.contains(.alert)
}
return notificationsEnabled
}
}
比起使用它
UIApplication.shared.remoteNotificationsEnabled()
关于ios - isRegisteredForRemoteNotifications 返回 true 即使我完全禁用它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29787736/
我正在创建一个 iPhone 应用程序,并希望在应用程序中的某个时间点询问用户推送通知,也就是当他打开开关时。 流程是这样的:启动应用程序->玩游戏->结束游戏->出现带有开关的自定义弹出窗口,询问您
问题 isRegisteredForRemoteNotifications 即使我已成功收到设备 token ,也返回false。 情况 1。注册 在用户安装我的应用程序后,在特定时间点,我会检查 i
在推送通知中,isRegisteredForRemoteNotifications这个方法在模拟器中会返回NO,但在设备中会返回YES。为什么它会有这样的 react ?每次我在设备中运行时需要更改代
我收到了弹出窗口,我已经接受了,我在通知中看到它并且它已打开但是这段代码总是返回否,我似乎无法找出原因 UIApplication *application = [UIApplication shar
下面的方法一直返回相同的值: [[UIApplication sharedApplication] isRegisteredForRemoteNotifications]; 每次运行此代码时,结果都是
if UIApplication.sharedApplication().isRegisteredForRemoteNotifications() == true { println("Yes
当我的 iOS 应用程序收到推送通知时,出现了一个奇怪的情况。用户界面保持锁定状态,没有任何效果。当我暂停调试器时,我在我的线程中看到 semaphore_wait_trap。 调试我能看到的代码与两
我是一名优秀的程序员,十分优秀!