专家,我有一个场景,我需要每天三次(早上,下午,晚上)通知用户.根据每个日期的数据库值,这些通知的时间每天都会有所不同.
这三个通知是可配置的.意思是用户可能只是选择设置下午和晚上,同时关闭设置下的早晨通知.
根据我的理解,我可以使用本地通知实现此目的.
我可以执行以下操作: - 在应用程序退出之前,在didFinishLaunchingWithOptions中,我可以检查下一个通知到期是什么,是否设置(开/关).如果设置,我安排它.如果不是,我继续下一个通知类型并做同样的事情.如果关闭所有通知,显然不会安排任何通知.
现在,当通知显示时,我会看到警报,其中有两个按钮"关闭"和"查看".如果用户选择"查看",我的应用程序将恢复活动状态,并在用户退出之前安排下一个通知.
到现在为止还挺好.
现在,如果用户选择"关闭",我该怎么办?它不会启动我的应用程序,因此下一个通知不会被安排?
我该如何实现这一目标?有没有更好的方法来做到这一点?
救命!救命!救命!
有没有办法唤醒iOS应用程序而不使用"重大变化位置服务"?
我需要在没有服务器或用户干预的情况下唤醒我的应用程序有些类似于闹钟,其中你在唤醒时获得警报弹出窗口.
UILocalNotification - 无法工作,因为它需要用户和服务器干预.
无声推送通知 - 由于您无法将本地通知作为无声推送通知发送,因此无法正常工作.这些只能由服务器发送.这意味着它需要服务器干预
后台获取 - 由于没有保证的触发时间而无法工作
我错过了什么吗?
以下命令以千字节为单位返回可用内存
cat /proc/meminfo | grep MemFree | awk '{ print $2 }'
有人可以建议使用单个命令来获取gb中的可用内存吗?
我是iphone app开发的新手.
我的问题是,当我的应用程序在后台运行时,如何显示弹出窗口(UIAlertView)?我正在使用xcode 4.2 for ios 6我无法通过互联网找到满意的答案.有人可以帮我这个吗?
- (void)applicationDidEnterBackground:(UIApplication *)application
{
UIApplication* app = [UIApplication sharedApplication];
bgTask = [app beginBackgroundTaskWithExpirationHandler:^{
[app endBackgroundTask:bgTask];
bgTask = UIBackgroundTaskInvalid;
}];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSTimer* t = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(doBackgroundProcessing) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:t forMode:NSDefaultRunLoopMode];
[[NSRunLoop currentRunLoop] run];
});
Run Code Online (Sandbox Code Playgroud)
}
- (void) doBackgroundProcessing
{
global = [lMGlobal getInstance];
while(TRUE)
{
[self showAlertFor:@"Hello" andMessage:@"Wake up"];
[NSThread sleepUntilDate:[lMGlobal getSleepDuration]];
}
}
- (void) showAlertFor:(NSString *)title andMessage:(NSString*)message
{
UIAlertView *alertDialog;
alertDialog = [[UIAlertView alloc]
initWithTitle:title
message:message …Run Code Online (Sandbox Code Playgroud)