objective-c - +CLPlacemark 的 placemarkWithLocation 方法

标签 objective-c clplacemark

我想用这个方法。 https://developer.apple.com/reference/corelocation/clplacemark/2132103-placemarkwithlocation?language=objc#declarations

我导入了 CoreLocation,但仍然收到“无已知类方法”错误,而且我也没有在 CLPlacemark.h 中的任何位置看到它的定义。

+ (instancetype)placemarkWithLocation:(CLLocation *)location 
                                 name:(NSString *)name 
                        postalAddress:(CNPostalAddress *)postalAddress;

最佳答案

根据文档,

App extensions built with the Intents framework can use this method to create a placemark from existing location and address data. For example, an app that offers a ride service might create a new placemark when resolving a user’s pickup or drop-off location. The returned placemark contains only the data that you provide.

所以你需要导入Intents框架:

@import Intents;

关于objective-c - +CLPlacemark 的 placemarkWithLocation 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42636461/

相关文章:

ios - 如何在控制中心检测蓝牙是否真的关闭(或蓝牙开关按钮关闭)

objective-c - 在 UITextView 中显示 NSMutableArray 的内容

ios - 带 CLPlacemark 的 if let 语句

ios - 使用 Swift 4/Xcode 9 从 CLPLacemark 获取完整地址字符串

ios - 如何设置 MKPlacemark 的显示名称?

java - 将缓冲区转换为无符号整数并使用位掩码

iphone - 核心数据 - GROUP BY

iOS 不平衡调用 applicationWillResignActive : and applicationDidBecomeActive:

ios - 使用自定义值创建 CLPlacemark 以进行测试

ios - CLPlacemark 地址iOS 9 上的字典键