简体   繁体   English

即使找不到CLLocation <CoreLocation/CoreLocation.h> 是进口的

[英]CLLocation can't be found even though <CoreLocation/CoreLocation.h> is imported

#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>

@interface SomeClass : NSObject
{
    CLLocation *location;
    //...
}

//...

Code seems okay, right? 代码似乎没问题吧? But I still get "Unknown type name 'CLLocation'", even though CoreLocation.framework is imported to "Link Binary with Libraries" and CoreLocation.h is imported. 但我仍然得到“未知类型名称'CLLocation'”,即使CoreLocation.framework导入到“Link Binary with Libraries”并导入CoreLocation.h。

This error occured after I added a new target to the project - "Cocoa Touch Unit Testing Bundle". 在我向项目添加新目标后出现此错误 - “Cocoa Touch Unit Testing Bundle”。 CoreLocation.framework is imported to this target, too. CoreLocation.framework也导入到此目标。

删除和添加框架是我解决同一问题的最佳解决方案。还要确保为单元测试项目添加了框架。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM