简体   繁体   English

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

[英]display UIAlert when apps running on background?

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

[alertView show];

How could I display alert when apps running background? 应用在后台运行时如何显示警报?

Use a UILocalNotification when your app is in the background. 当您的应用程序在后台时,请使用UILocalNotification

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM