我有一个Obj-C项目,我正试图迁移到Swift.我的确在各种课程上取得了成功,但最近遇到了一个我似乎无法理解的问题.当我试图编译我当前的代码库时,我得到以下信息(超级无用的错误消息)
命令/Applications/Xcode.app/Contents/Developer/toolschains/xcodefault.xctoolchain/usr/bin/swiftc失败,退出代码为1
我唯一的假设是它在某种程度上与我的桥接头相关,但Xcode没有给我足够的信息来判断这是否真的是真的.
我用Cocoapods
把CorePlot
加到我的项目中.我正在try 将以下类迁移到Swift:
Obj-C类(ScatterPlotContainer.h)
#import <Foundation/Foundation.h>
@class CPTScatterPlot;
@interface ScatterPlotContainer : NSObject
@property (nonatomic, strong) CPTScatterPlot *ahrsAlt;
@property (nonatomic, strong) CPTScatterPlot *calibration;
@property (nonatomic, strong) CPTScatterPlot *coreAlt;
@property (nonatomic, strong) CPTScatterPlot *pitch;
@property (nonatomic, strong) CPTScatterPlot *roll;
@property (nonatomic, strong) CPTScatterPlot *slip;
@end
Obj-c类(ScatterPlotContainer.m)
#import <CorePlot/CPTScatterPlot.h>
#import "ScatterPlotContainer.h"
@implementation ScatterPlotContainer {
}
@end
快速转换
import Foundation
class ScatterPlotContainer : NSObject {
public var ahrsAlt : CPTScatterPlot;
public var calibration : CPTScatterPlot;
public var coreAlt : CPTScatterPlot;
public var pitch : CPTScatterPlot;
public var roll : CPTScatterPlot;
public var slip : CPTScatterPlot;
}
我的桥接头文件
#import <CorePlot/CPTScatterPlot.h>
到目前为止我都试过了
当我从桥接头文件中注释掉#import <CorePlot/CPTScatterPlot.h>
时,我在swift中得到一个错误,因为它不知道什么是CPTSatterPlot
我也试了#import <CPTScatterPlot.h>
次,但都没用.
思想
所以我能想到的唯一一件事可能是,因为我使用的是可可荚,所以我需要添加一些模块名.错误消息真的没有那么有用.有没有人对我犯的一些刺耳的错误有什么建议,或者如何获得更具描述性的错误消息来了解发生了什么?