本地通知 - 如果用户在 30 秒后没有第一次也没有第二次“任何”
我为本地通知工作,并且我构建的所有功能都功能齐全
,然后在启动我的通知
消息时显示 2 个按钮 如果按“查看”按钮=>这是启动应用程序 如果按下第二个的“关闭”按钮,他正在密切工作,
我想,“如果用户不首先也不第二个 30秒后任意” => (30秒后 - 语音警报“29.mp3”结束后)但如果用户不是第一个而不是第二个,我就不会按 30秒后任意 显示特定的声音(30 秒后),我该如何执行此操作
以及使用什么 deligate 方法执行该功能
-(IBAction) ScheduleNotification1 {
local1 = [[UILocalNotification alloc] init];
// create date/time information
local1.fireDate = [NSDate dateWithTimeIntervalSinceNow:2];
local1.timeZone = [NSTimeZone defaultTimeZone];
// set notification details
local1.alertBody = @"2!";
local1.alertAction = @"View";
//local1.soundName = UILocalNotificationDefaultSoundName;
//local1.soundName = @"alarmsound.caf";
local1.soundName = @"29.mp3";
// set the badge on the app icon
local1.applicationIconBadgeNumber = 1;
// local1.repeatInterval =NSSecondCalendarUnit;//// NSMinuteCalendarUnit;
//local1.repeatInterval =1 ;
// Gather any custom data you need to save with the notification
NSDictionary *customInfo = [NSDictionary dictionaryWithObject:@"ABCD2" forKey:@"yourKey1"];
local1.userInfo = customInfo;
// Schedule it!
[[UIApplication sharedApplication] scheduleLocalNotification:local1];
//[local1 release];
}
I work for local notification and all I have built fully functional
And follows that when launches my notification
Message shows the 2 buttons
If the press on "viwe" button => it's the launches application
And if the press on "close" button of the second, he's working close
I want to, "if the user does not first and not the second
Any after 30 seconds "
=> (after 30 seconds - After the end of a voice alert "29.mp3") but I did not press if the user does not first and not the second
Any after 30 seconds
That shows a specific sound (after 30 seconds), how can I do this
and what deligate method do that functionality
-(IBAction) scheduleNotification1 {
local1 = [[UILocalNotification alloc] init];
// create date/time information
local1.fireDate = [NSDate dateWithTimeIntervalSinceNow:2];
local1.timeZone = [NSTimeZone defaultTimeZone];
// set notification details
local1.alertBody = @"2!";
local1.alertAction = @"View";
//local1.soundName = UILocalNotificationDefaultSoundName;
//local1.soundName = @"alarmsound.caf";
local1.soundName = @"29.mp3";
// set the badge on the app icon
local1.applicationIconBadgeNumber = 1;
// local1.repeatInterval =NSSecondCalendarUnit;//// NSMinuteCalendarUnit;
//local1.repeatInterval =1 ;
// Gather any custom data you need to save with the notification
NSDictionary *customInfo = [NSDictionary dictionaryWithObject:@"ABCD2" forKey:@"yourKey1"];
local1.userInfo = customInfo;
// Schedule it!
[[UIApplication sharedApplication] scheduleLocalNotification:local1];
//[local1 release];
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您必须在第一个通知后 30 秒安排第二个通知,并在用户按下查看按钮时取消它。您不能在系统通知警报中内置计时器。
I think you will have to schedule a second notification 30 seconds after the first one, and cancel it if the user presses the view button. You can't have a timer built in to the system notification alert.