У меня есть следующий код, который создает локальное уведомление, которое появляется в строке состояния телефона. Созданное уведомление исчезает через некоторое время, даже если я не получаю к нему доступ.
UILocalNotification *localNotification = [[[UILocalNotification alloc] init] autorelease];
if (!localNotification)
return;
// Current date
NSDate *date = [NSDate date];
// Add one minute to the current time
NSDate *dateToFire = [date dateByAddingTimeInterval:60];
// Set the fire date/time
[localNotification setFireDate:dateToFire];
[localNotification setTimeZone:[NSTimeZone defaultTimeZone]];
localNotification.repeatInterval = 0;
// Create a payload to go along with the notification
NSArray *array = [NSArray arrayWithObjects:@"Value 1", @"Value 2", nil];
NSDictionary *data = [NSDictionary dictionaryWithObject:array forKey:@"payload"];
[localNotification setUserInfo:data];
// Setup alert notification
[localNotification setAlertBody:@"Incoming notification"];
[localNotification setAlertAction:@"Open App"];
[localNotification setHasAction:YES];
// Schedule the notification
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
Может ли кто-нибудь помочь мне создать уведомление, которое будет отображаться в строке состояния, пока пользователь не получит к нему доступ?
Спасибо