+placemarkWithLocation 方法用于 CLPlacemark

+placemarkWithLocation method for CLPlacemark

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

我导入了 CoreLocation 但我仍然遇到 "No known class method" 错误,而且我也没有在 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;