当应用程序在后台运行时显示UIAlert?

时间:2013-03-29 11:56:28

标签: ios objective-c

UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"open app" message:@" backgr..." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];

[alertView show];

如果应用运行背景,我怎么能显示警告?

1 个答案:

答案 0 :(得分:4)

当您的应用在后台时使用UILocalNotification

UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.alertBody = @"Your message";
notification.alertAction = @"Open app";
[[UIApplication sharedApplication] presentLocalNotificationNow:notification];