我正在使用Swift 1.1编译器上的iOS Swift项目。我决定将整个项目转换为Swift 1.2。
我与HanekeSwift以及Alamofire一起作为第三方图书馆。由于我需要支持这个应用程序,iOS 7及更高版本我不得不使用iOS 7兼容版本的HanekeSwift(https://github.com/eyeballz/HanekeSwift)。对于崩溃报告,我使用了崩解剂。
经过大约一个小时的努力,我可以手动将整个项目迁移到Swift 1.2。解除所有错误后,当我开始构建项目时,它会成功编译所有文件,但它不会停止编译。
大约10分钟后,它会出现以下错误: " 命令由于信号而失败:已杀死:9 "。我通过扩展它检查了所有的成绩单,它没有显示任何问题。
当我查看" 报告导航器"它显示所有文件中带有白色箭头的绿色圆圈图标,但只有一个文件显示灰色圆圈图标,它显示正在进行编译。
我无法在该文件中找到任何编译时错误,而且我不确定那里发生了什么。
任何人都有任何想法?
编辑: 我尝试将所有文件添加到使用xCode 6.4创建的项目中,但问题是相同的。
编辑: 我有一个类如下:
import Foundation
class VehicleDetailsUpdateRequest
{
var vin : NSString
var vehicleId : NSNumber
var make : NSString
var model : NSString
var body : NSString
var engine: NSString
var trim:NSString
var fuelType : NSString
var cityMpg : NSString
var highwayMpg : NSString
var transmission: NSString
var year: NSNumber
var cylinders: NSString
var driveType: NSString
var msrp: NSNumber
var marketClass : NSString
var vehicleType : NSNumber
var sellingPrice: NSNumber
var internetPrice: NSNumber
var stockNumber: NSString
var dateInStock: NSDate
var millage : NSString
var styleName : NSString
var styleId : NSString
var doors : NSNumber
var driverType : NSNumber?
var bodyType : NSString
var locationId : NSNumber
init(
vin : NSString,
vehicleId : NSNumber,
make : NSString,
model : NSString,
body : NSString,
engine: NSString,
trim:NSString,
fuelType : NSString,
cityMpg : NSString,
highwayMpg : NSString,
transmission: NSString,
year: NSNumber,
cylinders: NSString,
driveType: NSString,
msrp: NSNumber,
marketClass : NSString,
vehicleType : NSNumber,
sellingPrice: NSNumber,
internetPrice: NSNumber,
stockNumber: NSString,
dateInStock: NSDate,
millage : NSString,
styleName : NSString,
styleId : NSString,
doors : NSNumber,
bodyType : NSString,
locationId : NSNumber
)
{
self.vin = vin
self.vehicleId = vehicleId
self.make = make
self.model = model
self.body = body
self.engine = engine
self.trim = trim
self.fuelType = fuelType
self.cityMpg = cityMpg
self.highwayMpg = highwayMpg
self.transmission = transmission
self.year = year
self.cylinders = cylinders
self.driveType = driveType
self.msrp = msrp
self.marketClass = marketClass
self.vehicleType = vehicleType
self.sellingPrice = sellingPrice
self.internetPrice = internetPrice
self.stockNumber = stockNumber
self.dateInStock = dateInStock
self.millage = millage
self.styleName = styleName
self.styleId = styleId
self.doors = doors
self.bodyType = bodyType
self.locationId = locationId
}
}
我使用这个课程如下:
func createVehicleAddEditParams(vehicleUpdateRequest : VehicleDetailsUpdateRequest) -> [String: AnyObject]
{
let params : [String: AnyObject] =
[
"VIN":vehicleUpdateRequest.vin,
"VehicleId":vehicleUpdateRequest.vehicleId,
"Make":vehicleUpdateRequest.make,
"Model":vehicleUpdateRequest.model,
"Body":vehicleUpdateRequest.body,
"Engine":vehicleUpdateRequest.engine,
"Trim":vehicleUpdateRequest.trim,
"FuelType":vehicleUpdateRequest.fuelType,
"CityMpg":vehicleUpdateRequest.cityMpg,
"HwyMpg":vehicleUpdateRequest.highwayMpg,
"Transmission":vehicleUpdateRequest.transmission,
"Year":vehicleUpdateRequest.year,
"Cylinders":vehicleUpdateRequest.cylinders,
"DriveType":vehicleUpdateRequest.driveType,
"MSRP":vehicleUpdateRequest.msrp,
"MarketClass":vehicleUpdateRequest.marketClass,
"Styles":"",
"VehicleType":vehicleUpdateRequest.vehicleType,
"SellingPrice":vehicleUpdateRequest.sellingPrice,
"InternetPrice":vehicleUpdateRequest.internetPrice,
"StockNumber":vehicleUpdateRequest.stockNumber,
"DateInStock":vehicleUpdateRequest.dateInStock,
"Millage":vehicleUpdateRequest.millage,
"Certified":0,
"StyleName":vehicleUpdateRequest.styleName,
"StyleId":vehicleUpdateRequest.styleId,
"Doors":vehicleUpdateRequest.doors,
"DriverType":"",
"BodyType":vehicleUpdateRequest.bodyType,
"VehicleImages":[],
"LocationId":vehicleUpdateRequest.locationId,
"Options":""
]
return params
}
如果我评论(params创建部分)以上代码,这个问题就会消失。有人在这看到奇怪的事吗?
答案 0 :(得分:1)
我不确定原因,但我的建议是复制所有代码,然后制作一个新项目。我猜测某些内容转换错误,但初始化一个新项目会给你一个新的起点。
如果您不想这样做,另一个建议是清理您的项目和您的测试用例。
答案 1 :(得分:1)
经过如此多的R& D步骤,我找到了上述问题的解决方案。我将所有NSString变量转换为String类型变量。
现在我的班级如下所示:
import Foundation
class VehicleDetailsUpdateRequest
{
var vin : String
var vehicleId : NSNumber
var make : String
var model : String
var body : String
var engine: String
var trim:String
var fuelType : String
var cityMpg : String
var highwayMpg : String
var transmission: String
var year: NSNumber
var cylinders: String
var driveType: String
var msrp: NSNumber
var marketClass : String
var vehicleType : NSNumber
var sellingPrice: NSNumber
var internetPrice: NSNumber
var stockNumber: String
var dateInStock: NSDate
var millage : String
var styleName : String
var styleId : String
var doors : NSNumber
var driverType : NSNumber?
var bodyType : String
var locationId : NSNumber
init(
vin : String,
vehicleId : NSNumber,
make : String,
model : String,
body : String,
engine: String,
trim: String,
fuelType : String,
cityMpg : String,
highwayMpg : String,
transmission: String,
year: NSNumber,
cylinders: String,
driveType: String,
msrp: NSNumber,
marketClass : String,
vehicleType : NSNumber,
sellingPrice: NSNumber,
internetPrice: NSNumber,
stockNumber: String,
dateInStock: NSDate,
millage : String,
styleName : String,
styleId : String,
doors : NSNumber,
bodyType : String,
locationId : NSNumber
)
{
self.vin = vin
self.vehicleId = vehicleId
self.make = make
self.model = model
self.body = body
self.engine = engine
self.trim = trim
self.fuelType = fuelType
self.cityMpg = cityMpg
self.highwayMpg = highwayMpg
self.transmission = transmission
self.year = year
self.cylinders = cylinders
self.driveType = driveType
self.msrp = msrp
self.marketClass = marketClass
self.vehicleType = vehicleType
self.sellingPrice = sellingPrice
self.internetPrice = internetPrice
self.stockNumber = stockNumber
self.dateInStock = dateInStock
self.millage = millage
self.styleName = styleName
self.styleId = styleId
self.doors = doors
self.bodyType = bodyType
self.locationId = locationId
}
}
希望这会以某种方式帮助你们所有人。