简体   繁体   中英

iOS Core-location: How to disable the default iOS pop-up message for user permission

I am using core location framework to collect the device location in my iOS app. When i install the app for the first time in device, iOS asks for the user permission with a alert view as below.

应用截图用户权限

Is there any way to disable this default alert view and display a customized message to the user?

I added screen shot where to add purpose message.

在此处输入图片说明

Those alerts are system generated and not editable by the developer. If they were editable, then the developer could change the meaning or make it not obvious to the end user what permissions they were asking for.

For user privacy reasons, this prompt/alert is system generated and you can't disable it if your app uses core location.

Having said that, however, you can delay the display of this alert in your app by organizing your code flow such that location services are only called when needed (lazy initialization).

As per apple docs , read notes under method -

+ (BOOL)locationServicesEnabled

Location services prompts users the first time they attempt to use location-related information in an app but does not prompt for subsequent attempts. If the user denies the use of location services and you attempt to start location updates anyway, the location manager reports an error to its delegate.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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