0

I am trying to get a notification to appear when the app is in the background or suspented, as the LocalNotification does not work, I seen mention the CFUserNotification as a potential solution, but when i include the corefoundation framework to my app the CFUserNotification is still no-where to be found, can someone show me how to include CFUserNotification in my project ?

4

2 回答 2

3

你可以在 IOS 5.1 中使用 CFUserNotification 吗?

于 2012-04-30T11:19:24.117 回答
1

如果你不是为 App Store 制作这个,你可以使用私有 API。我使用 CFUserNotifications 的方式是

  1. 将 CoreFoundation.framework 添加到我链接的框架列表中(也许这个框架是自动包含的……我不确定……我只知道将它显式添加到您的项目中并没有什么坏处)。

  2. 正如 Justin 所说,CoreFoundation 公共 API 在标头中仍然没有 CFUserNotification 函数。因此,您需要手动包含一个完整的CFUserNotification.h 标头。你可以在这里找到一份副本。只需复制整个头文件,并将其包含在您的项目源目录中。然后#import "CFUserNotification.h"你想在哪里使用它。

然后,编译器将允许您访问这些CFUserNotificationAPI。我已经成功地在 iOS 5.0 上完成了此操作(在设备上)。

于 2012-06-09T21:06:15.650 回答