requestWhenInUseAuthorization() not Work in iOS 8 With NSLocationWhenInUseUsageDescription Key in Info.plist

前端 未结 3 1196
花落未央
花落未央 2020-12-19 17:43

I am using iOS SDK 8.1 trying to call requestWhenInUseAuthorization() method to prompt user to grant access to my app. I imported CoreLocation.framework, and added NSLocatio

3条回答
  •  孤城傲影
    2020-12-19 18:12

    Problem solved. My manager was declared as local var inside viewDidLoad() method, but it should've been a class level property.

    After I moved manager declaration out of viewDidLoad(), my app worked.

    Not sure how exactly manager.requestWhenInUseAuthorization() work behind the scene and why exactly manager defined within viewDidLoad() not work. Hope someone who knows this detail enlighten me.

提交回复
热议问题