简体   繁体   English

iOS 8 MkMapKit无法获取用户位置

[英]iOS 8 MkMapKit cannot Get Users Location

when i am trying to get user location in iOS-8 当我尝试获取iOS-8中的用户位置时

iam getting this error 我收到这个错误

Trying to start MapKit location updates without prompting for location authorization. 尝试启动MapKit位置更新而没有提示位置授权。 Must call 必须致电

-[CLLocationManager requestWhenInUseAuthorization] or -[CLLocationManager requestAlwaysAuthorization] first.

I have implemented:if(IS_OS_8_OR_LATER) {
    [self.Mylocation requestWhenInUseAuthorization];
    [self.Mylocation requestAlwaysAuthorization];
}

iam getting device location as 0.00, 0.00 IAM获取设备位置为0.00,0.00

please help me 请帮我

In your Supporting Files folder, there should be a file called "your bundle identifier-Info.plist". 在“支持文件”文件夹中,应该有一个名为“您的捆绑包标识符-Info.plist”的文件。

Depending on which type of location authorisation you are using (when in use or always) will determine what plist property you will need to add. 根据您使用的位置授权类型(使用时或始终使用),将确定您需要添加哪些plist属性。

If you are using "always" usage, you will need to add the following identifier: NSLocationAlwaysUsageDescription , then add a descriptive string as to why you need to use the location. 如果您使用的是“始终”用法,则需要添加以下标识符: NSLocationAlwaysUsageDescription ,然后添加有关为什么需要使用该位置的描述性字符串。

If you want to only access the location when the app is in use, you need to add the following property: NSLocationWhenInUseDescription and again, add a relevant description string. 如果仅在使用应用程序时访问位置,则需要添加以下属性: NSLocationWhenInUseDescription然后再次添加相关的描述字符串。

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

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