@import非法接口限定符

时间:2015-05-07 15:48:21

标签: ios objective-c

iOS开发新手。我遇到的问题是@import Foundation;正在运行错误:

illegal interface qualifier

WXClient.h中的代码:

#import <Foundation/Foundation.h>
@import CoreLocation;
#import <ReactiveCocoa.h>

@interface WXClient : NSObject

@import Foundation;
  - (RACSignal *)fetchJSONFromURL:(NSURL *)url;
  - (RACSignal *)fetchCurrentConditionsForLocation:(CLLocationCoordinate2D)coordinate;
  - (RACSignal *)fetchHourlyForecastForLocation:(CLLocationCoordinate2D)coordinate;
  - (RACSignal *)fetchDailyForecastForLocation:(CLLocationCoordinate2D)coordinate;

@end

1 个答案:

答案 0 :(得分:2)

您无法将@import放入班级声明中。把它与其他进口产品一起使用。此外,如果您要将基金会作为模块导入,则根本不需要进行此导入#import <Foundation/Foundation.h>

@import Foundation;
@import CoreLocation;
#import <ReactiveCocoa.h>

@interface WXClient : NSObject

  - (RACSignal *)fetchJSONFromURL:(NSURL *)url;
  - (RACSignal *)fetchCurrentConditionsForLocation:(CLLocationCoordinate2D)coordinate;
  - (RACSignal *)fetchHourlyForecastForLocation:(CLLocationCoordinate2D)coordinate;
  - (RACSignal *)fetchDailyForecastForLocation:(CLLocationCoordinate2D)coordinate;

@end