Ios8 ios 8中当前位置的错误

Ios8 ios 8中当前位置的错误,ios8,Ios8,我在ios 8中使用此代码作为当前位置,但这在第3行给出了错误 错误为“选择器'requestAlwaysAuthorization'没有已知的类方法” 在iOS 8 SDK中,启动位置更新之前,需要对CLLocationManager进行请求始终授权(用于后台位置)或请求未使用授权时的授权(仅用于前台位置) 在plist中添加两个关键点 <key>NSLocationAlwaysUsageDescription</key> <string>Your mess

我在ios 8中使用此代码作为当前位置,但这在第3行给出了错误 错误为“选择器'requestAlwaysAuthorization'没有已知的类方法”


在iOS 8 SDK中,启动位置更新之前,需要对CLLocationManager进行请求始终授权(用于后台位置)或请求未使用授权时的授权(仅用于前台位置)

在plist中添加两个关键点

<key>NSLocationAlwaysUsageDescription</key>
<string>Your message goes here</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Your message goes here</string>
NSLocationAlwaysUsageDescription
你的留言在这里
NSLocationWhenUse用途说明
你的留言在这里
(保留值为空以使用默认消息)

<key>NSLocationAlwaysUsageDescription</key>
<string>Your message goes here</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Your message goes here</string>