- objective-c - iOS 5 : Can you override UIAppearance customisations in specific classes?
- iphone - 如何将 CGFontRef 转换为 UIFont?
- ios - 以编程方式关闭标记的信息窗口 google maps iOS
- ios - Xcode 5 - 尝试验证存档时出现 "No application records were found"
这有可能吗? UIApplication's
scheduledLocalNotifications
似乎没有返回已经发送到用户通知中心的通知,所以我认为这可能是设计使然,但我找不到任何有据可查的证据。
有人知道吗?
谢谢!
编辑:发现这个:
You can cancel a specific scheduled notification by calling cancelLocalNotification: on the application object, and you can cancel all scheduled notifications by calling cancelAllLocalNotifications. Both of these methods also programmatically dismiss a currently
但是,如果 scheduledLocalNotifications
没有给我已发送的通知,我如何获得对已发送通知的引用?
编辑 2:
这是我在注册一些通知后尝试做的事情:
UIApplication *app = [UIApplication sharedApplication];
for (UILocalNotification *localNotification in app.scheduledLocalNotifications)
{
if (someCondition) {
[app cancelLocalNotification:localNotification];
}
}
}
问题是,一旦它们被交付,它们就不再处于“scheduledLocalNotifications”中。
最佳答案
您可以通过将新创建的通知添加到您自己的 NSMutableArray
通知并检查该数组而不是 app.scheduledLocalNotifications
来解决此问题。像这样:
将 NSMutableArray
添加到您的 Viewcontrollers .h 文件中:
NSMutableArray *currentNotifications;
在启动 ViewController 时启动它
currentNotifications = [[NSMutableArray alloc] init];
发起通知时,也将其添加到您的数组中:
UILocalNotification *notification = [[UILocalNotification alloc] init];
...
[currentNotifications addObject:notification];
[[UIApplication sharedApplication] presentLocalNotificationNow:notification];
稍后当您想要取消该通知时,请改为在您的数组中查找它。同时将它从你的数组中删除:
for (UILocalNotification *notification in currentNotifications) {
if (someCondition) {
[[UIApplication sharedApplication] cancelLocalNotification:notification];
[currentNotifications removeObject:notification];
}
}
关于ios - 关闭已经传送的 UILocalNotification?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10652274/
Pygame 我想知道是否有人知道如何在触摸或越过某些东西时交换 map 。 这是我的代码: import pygame, sys from pygame.locals import * pygame
我正在尝试使用以下代码将用户传送到他们自己的领域: @EventHandler public static void onPortalTravel(PlayerPortalEvent event) t
我想要对不同选项的简要介绍。 最佳答案 来自 Wikipedia Embedded in an SWF file using the Flash authoring tool (supported i
我正在尝试创建一个简单的程序来刺激二进制系统中恒星的旋转,但是当我运行程序时,其中一个“恒星”出现故障,实际上是围绕给定路径传送到不同位置。我怎样才能解决这个问题?这是代码: import pygam
我不会java(一般用c写) 我怎样才能有效地进行某种位 block 传送方式java中的像素数组内容到窗口上? 我需要(在循环中)将像素[][]传输到窗口上 我可以使用类似的东西 pixels[]
我遇到了无法通过 TestFlight 安装我的应用程序的 Ad Hoc 版本的问题。应用程序下载,但在安装步骤中显示类似“无法安装 YourApp”的内容,控制台上显示以下消息: Sep 17 16
如果我使用 Eazfuscator 混淆 vb.net 程序集并启用符号名称加密(以便我可以使用 Eazfuscator 堆栈跟踪解码器),如果我发送 PDB 文件,这是否有效地撤消?我想发送 PDB
我使用 Delphi 6 Pro 和 DSPACK DirectShow 组件库来创建一个 DirectShow 过滤器,该过滤器从自定义音频源提供 Wav 格式的数据。需要明确的是,我将原始 PCM
我正在尝试发布一个执行一些 RMI 调用的 Java 应用程序。 我需要将其作为 JAR 文件发送(这是一个要求,没有办法解决)。 现在,为了允许某些事情(例如套接字和 RMI 连接),我需要一个 S
在 Vue 3 中,可以使用 Teleport body 的一个组件像这样标记: Open full screen modal! (With teleport!)
由于 Netty Channel 使用单个线程进行入站和出站处理,我很想知道在使用多路复用协议(protocol)(例如 SPDY)时传送入站数据的推荐做法。想到的几个选项: 1) 使用 channe
我基本上想这样做: $_ = "some content that need to be escaped &>|\"$\'`\s\\"; qx{echo $_ | foo} 这里有两个问题。先是$_的
我想使用 Kurento 作为媒体服务器,它将 WebRTC 作为输入并提供 RTSP 流作为 url:rtsp://kurento/streamName 这可能吗? 我看到了https://gith
我的理解是,在 Azure AMS V2 上,您可以进行混合 key 分发,您可以从另一台服务器(例如 S3)流式传输加密的媒体内容,并仅使用 Azure 作为 key 服务器。 This is my
我目前正在尝试通过用于控制视频访问的 PHP 脚本传送 MP4 视频以用于 HTML5 视频(使用 video-js)。经过一些研究,在 stackoverflow article found her
我使用以下命令将 sed 的输出重定向到 tmp 文件: grep --include=*.txt -A 3 -rnw abx/ -F -e 'simple' | sed -n 's#.*/\([^/
我有一个 PHP 文件,它的唯一工作是检查用户是否登录 + 是否设置了 session 变量,然后通过 nginx X-Sendfile 传送文件。它在任何桌面浏览器和以前的任何移动浏览器上都能完美运
我在 2014 年 1 月 24 日悄悄地向 iOS 应用商店交付了一个应用。这是一款仅限 iO7/iPhone 的应用程序,所有内容均已正确交付。截至昨天,我的应用程序已获批准,目前可以在 App
我是一名优秀的程序员,十分优秀!