我正在尝试在我的应用程序中创建多个本地通知,但由于某种原因,只有第一个通知弹出窗口出现,其余的只是不起作用,这是我的代码。
我有一个名为criaAlertas的类,它负责创建通知,在该类中我有以下方法:
-(void)setarNotificacao:(NSInteger)quando nome:(UILocalNotification *)notification
{
UIApplication *myapp = [UIApplication sharedApplication];
notification.fireDate = [NSDate dateWithTimeIntervalSinceNow:quando];
notification.alertBody = @"Nice";
notification.timeZone = [NSTimeZone defaultTimeZone];
notification.soundName = UILocalNotificationDefaultSoundName;
NSMutableArray *arrayOfNOtifications = [[NSMutableArray alloc]init];
[arrayOfNOtifications addObject:notification];
myapp.scheduledLocalNotifications = arrayOfNOtifications;
}
所以我实例化了该类的一个对象,并尝试这样做:
criaAlertas *novoAlerta = [[criaAlertas alloc]init];
UILocalNotification *notaUm = [[UILocalNotification alloc]init];
UILocalNotification *notaDois = [[UILocalNotification alloc]init];
[novoAlerta setarNotificacao:15 nome:notaUm];
[novoAlerta setarNotificacao:30 nome:notaDois];
我做错了什么?