gpt4 book ai didi

ios - 仅在 iOS 9 上崩溃 : [MKPlacemark initWithCoordinate:]: unrecognized selector

转载 作者:行者123 更新时间:2023-12-02 04:45:17 25 4
gpt4 key购买 nike

代码:

-(void)getRouteDirections{
MKDirectionsRequest *request = [[MKDirectionsRequest alloc] init];
[request setSource:[MKMapItem mapItemForCurrentLocation]];

// It crashes on this line:
MKPlacemark * placemark = [[MKPlacemark alloc]initWithCoordinate:_location.coordinate];
}

异常(exception):

-[MKPlacemark initWithCoordinate:]: unrecognized selector sent to instance

仅在 iOS 9 上崩溃。我该如何解决这个问题?

最佳答案

来自Larme的回答评论:

- (instancetype)initWithCoordinate:(CLLocationCoordinate2D)coordinate;自 iOS10 起可用。

对于 iOS 9 或更早版本,initWithCoordinate:addressDictionary:自 iOS 3 起可用。

关于ios - 仅在 iOS 9 上崩溃 : [MKPlacemark initWithCoordinate:]: unrecognized selector,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41486370/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com