推送通知是否存储在 iPhone 上的某个位置?

发布于 2024-09-14 19:28:56 字数 54 浏览 4 评论 0原文

如果是,用户如何才能再次重新阅读它们? 通过编码,您如何读取它们以将它们显示在您的应用程序中?

If yes, how it's possible for the user to re-read them again ?
By coding, how do you read them to display them in your app ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

笔芯 2024-09-21 19:28:56

我很确定问题更多的是关于显示在锁定屏幕中的通知/横幅消息,当您解锁手机时,无论您是否真正阅读它们,它们都会消失。手机只是假设您已获取它们,并且无法检索它们。这是 iPhone 考虑不周的方面之一……如果你输入联系人姓名,它就会按姓氏对联系人进行排序。

I'm pretty sure that the question was more about the notifications/banner messages which show up in the lock screen and all disappear when you unlock the phone, whether you actually read them or not. The phone just assumes you got them, and there is no way to retrieve them. It's one of the more poorly thought out aspects of the iPhone....up there with sorting contacts by last name if you enter one.

长伴 2024-09-21 19:28:56

推送通知不会存储到应用程序内存中。但您可以按照自己的意愿处理它们。我们需要处理推送通知主要有两种情况:

1) 应用程序关闭/后台模式
2) 应用程序处于活动模式

1) 要在应用程序未运行或在后台时处理推送,您需要单击推送通知弹出窗口,它将打开应用程序。下面是处理这种情况的代码:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    if (launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]) {
        self.isNoti = TRUE;
        NSMutableDictionary *dic = [[NSMutableDictionary alloc] initWithDictionary:[launchOptions valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey]];
// Do you stuff
    }
    return YES;
}

2) 如果您的应用程序处于活动状态:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler
{
    @try {
        NSLog(@"Push Notification!!!");
}

Push notification is not stored into application memory. But you can handle them as you want. There are mainly two case in which we need to handle the push notification:

1) Application is closed/background mode
2) Application is active mode

1) To Handle push when app is not running or in background, you need to click on push notification pop and it will open the application. Below is the code to handle this case:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    if (launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]) {
        self.isNoti = TRUE;
        NSMutableDictionary *dic = [[NSMutableDictionary alloc] initWithDictionary:[launchOptions valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey]];
// Do you stuff
    }
    return YES;
}

2) If your application is in active state:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler
{
    @try {
        NSLog(@"Push Notification!!!");
}
木落 2024-09-21 19:28:56

请阅读 Apple 文档推送通知和本地通知以了解它们之间的区别以及不同之处。
另外,请查看此教程,它将指导您开发一个示例应用程序。支持推送通知。

我希望你觉得它们有用

Please, read Apple's documentation regarding push and local notifications to understand what's the difference and how they are different.
Also, check this tutorial which will guide you on developing a sample app. that supports push notifications.

I hope you find them useful

兔姬 2024-09-21 19:28:56

如果您的 iPhone 上使用的是 IOS 5,您可以通过从上到下滑动屏幕来查看已保存的横幅通知。希望这有帮助。

You can see saved banner notifications by swiping the screen from top to bottom if using IOS 5 on your iPhone. Hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文