gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 20:19:59 25 4
gpt4 key购买 nike

在创建 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com