使用各种警报消息进行本地通知

时间:2012-06-25 09:25:20

标签: iphone uialertview uilocalnotification

我想多次发送本地通知。每次通知警报消息都不同时,下面有两个方法和委托方法接收到本地通知。这是一直提供相同的警报消息,但我想为不同的本地通知显示不同的警报。

方法一

{

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

local.fireDate =  [NSDate dateWithTimeIntervalSinceNow:15];

local.fireDate = start_fire_date;    

}

方法2

{

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];}}

2 个答案:

答案 0 :(得分:0)

你必须在点火通知时设置信息..

localNotif.alertBody =[NSString stringWithFormat:@"message"];

答案 1 :(得分: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;