jjzjj

UIUserNotificationSettings

全部标签

ios - 在 Swift 3 中没有更多上下文的表达式类型不明确

我正在尝试学习Swift并正在阅读有关推送通知的教程。letsettings=UIUserNotificationSettings(forTypes:[.Alert,.Badge,.Sound],categories:nil)给我错误"Typeofexpressionisambiguouswithoutmorecontext".我直接从教程中复制/粘贴了这一行,并在StackOverFlow上找到了这一行。我做错了什么?我使用的是Xcode8。 最佳答案 查看UIUserNotificationSettings的文档。它的签名在Sw

ios - 使用未声明的标识符 'UIUserNotificationSettings'

我正在尝试使用Xcode6编译现有应用程序。这是我的代码:UIUserNotificationSettings*settings=[UIApplication.sharedApplicationcurrentUserNotificationSettings];这是我的错误:useofundeclaredidentifier'UIUserNotificationSettings'我不知道如何解决这个问题。这是我对iOS8的检查:if(SYSTEM_VERSION_LESS_THAN(_iOS_8_0)){//Displayingnotificationsandringingif([sel

ios - 我如何确定用户是否曾经看到过请求推送通知权限的对话框 (ios)

我知道enabledremotenotificationtypes,但它对我没有帮助,因为如果我收到enabledremotenotificationtypes==UIRemoteNotificationTypeNone,我无法判断用户是否有1.接受过一次推送通知但随后通过稍后设置将其关闭或2.拒绝推送通知或3.从未见过请求许可的蓝色对话框。我需要一种方法来区分这三种情况。任何帮助将不胜感激。 最佳答案 该解决方案有点麻烦,但确实有效。您需要为两种不同的notificationSettings调用registerUserNotifi

ios - 'unsigned long ' UIUserNotificationSettings *' 的隐式转换不允许使用 arc

iOS8中的推送通知不起作用。错误显示:implicitconversionof'unsignedlong'UIUserNotificationSettings*'isdisallowedwitharc代码:-(BOOL)application:(UIApplication*)applicationdidFinishLaunchingWithOptions:(NSDictionary*)launchOptions{[applicationregisterUserNotificationSettings:(UIUserNotificationTypeSound|UIUserNotific

ios - UIUserNotificationSettings 拒绝快速接受多种通知类型

这个问题在这里已经有了答案:Swift2.0-BinaryOperator"|"cannotbeappliedtotwoUIUserNotificationTypeoperands(4个答案)关闭6年前。我正在尝试快速发送通知。这是我在注册通知的appdelegate.swift文件中的代码application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes:UIUserNotificationType.Alert|UIUserNotificationType.Badge|UIUserNotif

ios - 如何询问 UIUserNotificationSettings 类型

我正在尝试实现application:didRegisterUserNotificationSettings:AppDelegate方法来尝试确定是否允许我在iOS8中向用户发送本地通知。以下是我做的事情我正在努力实现,但这显然是不正确的方法。-(void)application:(UIApplication*)applicationdidRegisterUserNotificationSettings:(UIUserNotificationSettings*)notificationSettings{if(notificationSettings.types/*Howdoicheck

ios - 如何询问 UIUserNotificationSettings 类型

我正在尝试实现application:didRegisterUserNotificationSettings:AppDelegate方法来尝试确定是否允许我在iOS8中向用户发送本地通知。以下是我做的事情我正在努力实现,但这显然是不正确的方法。-(void)application:(UIApplication*)applicationdidRegisterUserNotificationSettings:(UIUserNotificationSettings*)notificationSettings{if(notificationSettings.types/*Howdoicheck

ios - UIUserNotificationSettings 的 Swift 3.0 语法更改

我正在使用swift3.0并尝试将角标(Badge)编号添加到我的应用程序中。我相信执行此操作的正确方法类似于以下内容。application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes:UIUserNotificationType.Sound|UIUserNotificationType.Alert|UIUserNotificationType.Badge,categories:nil))application.applicationIconBadgeNumber=5但是,我在使用“|”时遇

ios - UIUserNotificationSettings 的 Swift 3.0 语法更改

我正在使用swift3.0并尝试将角标(Badge)编号添加到我的应用程序中。我相信执行此操作的正确方法类似于以下内容。application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes:UIUserNotificationType.Sound|UIUserNotificationType.Alert|UIUserNotificationType.Badge,categories:nil))application.applicationIconBadgeNumber=5但是,我在使用“|”时遇

ios - Swift 2.0 - 二元运算符 "|"不能应用于两个 UIUserNotificationType 操作数

我正在尝试通过这种方式注册我的本地通知应用程序:UIApplication.sharedApplication().registerUserNotificationSettings(UIUserNotificationSettings(forTypes:UIUserNotificationType.Alert|UIUserNotificationType.Badge,categories:nil))在Xcode7和Swift2.0中-我收到错误BinaryOperator"|"不能应用于两个UIUserNotificationType操作数。请帮助我。 最佳
12