My app that worked fine on iOS 7 doesn't work with the iOS 8 SDK.

CLLocationManager doesn't return a location, and I don't see my app under Settings -> Location Services either. I did a Google search on the issue, but nothing came up. What could be wrong?

推荐答案

我最终解决了自己的问题.

显然,在iOS 8 SDK中,在开始位置更新之前,需要在CLLocationManager上调用requestAlwaysAuthorization(用于后台位置)或requestWhenInUseAuthorization(仅用于前台位置).

还需要在Info.plist中输入NSLocationAlwaysUsageDescriptionNSLocationWhenInUseUsageDescription键,并在提示中显示消息.添加这些解决了我的问题.

enter image description here

有关更多详细信息,请参阅:Core-Location-Manager-Changes-in-ios-8

Objective-c相关问答推荐

iOS - 如何预加载键盘?

iPhone 可达性判断

在objective-c中isa是什么意思?

防止其他程序员调用 -init 的最佳方法

在 UITableViewCells 上显示复制弹出窗口的简单方法,如地址簿应用程序

如何处理 Xcode 警告没有以前的函数原型......?

setFont 已弃用?

块引用作为Objective-C中的实例变量

UITableView - Select 了哪一行?

警告的含义在演示过程中!

未找到 RKObjectMapping.h

如何在表格视图中的两个单元格之间留出空间?

NSManagedObjectContext:异常断点在 save: 方法处停止,但没有日志(log)/崩溃/错误

获取包含在 NSString 中的文件的扩展名

根据文本量更改 UITableViewCell 高度

通过情节提要加载时如何初始化视图?

使 UILabel 的文本加粗

如何更改标签栏上的非活动图标/文本 colored颜色 ?

Block 隐式保留'self';明确提及touch以表明这是预期行为

UITableViewCell中的文本居中对齐问题