Jak utworzyć wiele powiadomień lokalnych
Próbuję utworzyć wiele lokalnych powiadomień w mojej aplikacji, ale z jakiegoś powodu tylko Pierwszy Pop powiadomienie jest na górze, reszta po prostu nie działa, to jest mój kod.
Mam klasę o nazwiecriaAlertas, który odpowiada za tworzenie powiadomień, w tej klasie mam następującą metodę:
-(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;
}
Więc stworzyłem instancję obiektu tej klasy i próbowałem to zrobić:
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];
Co robię źle?