有没有办法与 iOS 显示的警报进行交互。例如:如果我的应用程序已为 APNS 注册,在第一次启动时,iOS 会显示一个 UIAlertView(我假设它是一个),给用户两个选择。有没有办法找出用户选择了哪个按钮? 在我的应用程序启动期间,我有两个警报显示,一个用于 APNS,另一个用于定位服务。有没有办法确定哪个警报是针对什么?
最佳答案
如果您无法直接访问这些警报,我建议您从另一个角度来看这个问题。
例如,对于 CoreLocation,您可以查看它的 [CLLocationManager authorizationStatus]
。
kCLAuthorizationStatusNotDetermined = 0, // User wasn't proposed to use location services
kCLAuthorizationStatusRestricted, // Parental control or something like that
kCLAuthorizationStatusDenied, // User didn't allow this application to use services
kCLAuthorizationStatusAuthorized // User allowed to use his location.
至于 APNS,有 [[UIApplication sharedApplication] enabledRemoteNotificationTypes]
关于ios - 找出用户在 iOS 显示的 UIAlertView 上选择了哪个按钮的方法,请求允许应用程序接收推送通知的权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21673919/