简体   繁体   English

从UILocalNotification显示AlertView对话框

[英]Show AlertView dialog from UILocalNotification

In my app there should be an alarm when a certain distance is covered. 在我的应用程序中,当一定距离被覆盖时,应该会发出警报。 Originally, when the conditions are met, I wanted to move the app to the foreground, show an AlertView and play a sound. 最初,当条件满足时,我想将应用程序移至前台,显示AlertView并播放声音。 Due to answers to my former post I've implemented UILOcaLnotifications and it works fine for playing an AlertSound. 由于我以前的帖子的答案,我已经实现了UILOcaLnotifications,它可以很好地播放AlertSound。 Even when my app is in the background and thats great. 即使我的应用程序在后台运行,那也很棒。 One issue remains unsolved at this moment. 目前,一个问题尚未解决。 I really want to popup a dialog (AlertView) when the conditions are met. 当条件满足时,我真的想弹出一个对话框(AlertView)。

At this moment the ALert message is shown at the top of the screen (like a received message or missed call) but I want to present the user with a dialog (like in the clock app) 此时,ALert消息显示在屏幕顶部(例如收到的消息或未接来电),但我想向用户显示一个对话框(例如在时钟应用程序中)

Does anyone knows a solution to this question? 有谁知道这个问题的解决方案? Help is most appreciated. 非常感谢您的帮助。

Did you try to assign alertBody and alertAction? 您是否尝试分配alertBody和alertAction?

notification.alertBody = @"Some message";
notification.alertAction = @"View"; //title of action button
notification.hasAction = YES; //it YES by default 

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

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