iPhone 应用程序 - 应用程序关闭时生成警报弹出窗口

标签 iphone sdk notifications alerts reminders

在创建 iPhone 应用程序时,是否可以在应用程序关闭时在 iPhone 上生成弹出警报(类似于推送通知)。一个简单的例子是,有一个应用程序可以设置 2010 年 1 月 5 日下午 5:00 的提醒。该应用程序可以关闭,此时会弹出提醒。我认为这是不可能的,但想知道是否有人有任何想法?再说一遍,我不需要推送解决方案,而是不需要互联网访问的解决方案(即来自 iPhone 的“本地”推送)。谢谢。

最佳答案

你现在就可以做到!这确实相当简单。创建 UILocalNotification。

UILocalNotification *localNotification = [[UILocalNotification alloc] init];
        if (localNotification == nil)
            return;
//Initialise notification
        localNotification.fireDate = yourDate;
        localNotification.timeZone = [NSTimeZone defaultTimeZone];
        localNotification.alertBody = [NSString stringWithFormat:NSLocalizedString(@"Hey, you've forgotten something", nil)];
        localNotification.alertAction = [NSString stringWithFormat:NSLocalizedString(@"%@", nil), buttonTitle];
        localNotification.soundName = UILocalNotificationDefaultSoundName;
        [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
        [warningDate release];
        [localNotification release];

关于iPhone 应用程序 - 应用程序关闭时生成警报弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1467313/

相关文章:

iphone - 使用 IOS 供应门户进行配置时出现问题?

iphone - 将应用程序无线部署到 iPhone?

javascript - WSAPI 查询导致无限请求循环

sdk - 从我的网站自动登录 facebook

android - Android 中的 Clean Master 应用程序使通知变得垃圾

移动网站上的 Iphone 和 Blackberry 特定宽度问题

ios - 什么会导致 NSUserDefaults 被清除

iphone - 一次播放多个声音?

java - 如何让过时的应用程序版本显示一个对话框,表明有更新可用?

iOS:CKFetchNotificationChangesOperation 结果不完整