CoreLocation警告:不兼容的类型

DAS*_*DAS 2 xcode core-location ios incomplete-type

我收到以下错误警告:

Passing 'MyCLController *__strong' to parameter of incompatible type 'id<CLLocationManagerDelegate>'
Run Code Online (Sandbox Code Playgroud)

......在这一行:

self.locationManager.delegate = self;
Run Code Online (Sandbox Code Playgroud)

如果我删除该行,则整个位置更新过程失败.所以它是导入但也包含错误.

位置更新工作顺利,但我不知道如何摆脱这个消息......

必须与"新"Xcode 4有关...

有任何想法吗?

谢谢!

Ole*_*ann 6

您需要在接口定义中包含委托协议:

@interface MyCLController : NSObject <CLLocationManagerDelegate>
...
@end
Run Code Online (Sandbox Code Playgroud)