1

我想多次触发本地通知。每次通知警报消息应该不同,下面有两个方法和委托方法didreceivelocalnotification。这一直在发出相同的警报消息,但我想为不同的本地通知显示不同的警报。

方法一

{

UILocalNotification *local =[ [UILocalNotification alloc]init];

local.fireDate =  [NSDate dateWithTimeIntervalSinceNow:15];

local.fireDate = start_fire_date;    

}

方法二

{

UILocalNotification *local =[ [UILocalNotification alloc]init];

local.fireDate =  [NSDate dateWithTimeIntervalSinceNow:15];

local.fireDate = end_fire_date; 

}

application idReceiveLocalNotification:UILocalNotification {alert = [[UIAlertView alloc] initWithTitle:@"You come back ! (app was closed)" message:customInfo delegate:self cancelButtonTitle:nil otherButtonTitles:nil];}}
4

2 回答 2

0

当你发出通知时,你必须设置消息..

localNotif.alertBody =[NSString stringWithFormat:@"message"];
于 2012-06-25T09:31:21.540 回答
0

来自本地通知 .h 文件

@property(nonatomic,copy) NSString *soundName;      // name of resource in app's bundle to play or UILocalNotificationDefaultSoundName

将此设置为捆绑包中的声音文件

例子

UILocalNotification *local =[ [UILocalNotification alloc]init];

local.fireDate =  [NSDate dateWithTimeIntervalSinceNow:15];
local.soundName = @"yourSoundFile";
local.fireDate = end_fire_date; 
于 2012-06-25T09:31:29.953 回答