Objective c 目标C:尝试初始化CLLocation实例时出错
当遇到以下代码时,我遇到了一个错误(程序崩溃)Objective c 目标C:尝试初始化CLLocation实例时出错,objective-c,ios,cllocation,Objective C,Ios,Cllocation,当遇到以下代码时,我遇到了一个错误(程序崩溃) CLLocation *userLoc = [[CLLocation alloc] initWithCoordinate:locationManager.location.coordinate]; 我试着用下面的内容来替换这个参数,我也得到了同样的错误 CLLocation *userLoc = [[CLLocation alloc] initWithCoordinate:mapView.userLocation.coordinate]; 有谁
CLLocation *userLoc = [[CLLocation alloc] initWithCoordinate:locationManager.location.coordinate];
我试着用下面的内容来替换这个参数,我也得到了同样的错误
CLLocation *userLoc = [[CLLocation alloc] initWithCoordinate:mapView.userLocation.coordinate];
有谁能告诉我,对于用户的当前位置,这里应该使用什么样的正确参数
谢谢
甄
堆栈跟踪:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CLLocation initWithCoordinate:]: unrecognized selector sent to instance 0x1e0620'
根据,CLLocation
没有名为initWithCoordinate:
的初始值设定项。使用以下选项之一:
initWithLatitude:经度:
initWithCoordination:高度:水平精度:垂直精度:时间戳:
initWithCoordination:高度:水平精度:垂直精度:航向:速度:时间戳:
CLLocation
没有名为initWithCoordinate:
的初始值设定项。使用以下选项之一:
initWithLatitude:经度:
initWithCoordination:高度:水平精度:垂直精度:时间戳:
initWithCoordination:高度:水平精度:垂直精度:航向:速度:时间戳: