所以我开发了一个独立的罗盘应用程序(箭头旋转到指向tofixed lat / long point),它完全可以作为一个独立的项目工作,但是当我将它纳入更广泛的项目时,我遇到了问题。
最初我得到一个语义警告(不兼容的指针类型从'CLLoccation * __ strong'分配给'CLLocationManager *'):
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation {
if (newLocation.horizontalAccuracy >= 0) {
self.recentLocation = newLocation; (WARNING HERE)
CLLocation *POI2location = [[CLLocation alloc]
initWithLatitude:kPOI2Latitude
longitude:kPOI2Longitude];
CLLocationDistance delta = [POI2location
distanceFromLocation:newLocation];
进一步我得到致命错误(在'CLLocationManager类型的对象上找不到属性'坐标'):
- (void)locationManager:(CLLocationManager *)manager
didUpdateHeading:(CLHeading *)newHeading {
if (self.recentLocation != nil && newHeading.headingAccuracy >= 0) {
CLLocation *POI2Location = [[CLLocation alloc]
initWithLatitude:kPOI2Latitude
longitude:kPOI2Longitude];
double course = [self headingToLocation:POI2Location.coordinate
current:recentLocation.coordinate]; (WARNING HERE)
出于某种原因,它现在不喜欢'recentLocation',而之前它们都完美无缺。有人能向我指出我所缺少的东西。我相信对于比我更有经验的人来说,这是显而易见的。
非常感谢提前。
答案 0 :(得分:0)
今天早上再次开始,答案正盯着我看!
在.h文件中我放
@property (strong, nonatomic) CLLocationManager *recentLocation;
我应该放
@property (strong, nonatomic) CLLocation *recentLocation;