cocoapods – SwiftyJSON和Swift 3:无法转换’Int32’类型的返回表达式?返回类型>’Int?’

前端之家收集整理的这篇文章主要介绍了cocoapods – SwiftyJSON和Swift 3:无法转换’Int32’类型的返回表达式?返回类型>’Int?’前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我们正在使用 CocoaPods配置pod’ SwiftyJSON’,’3.1.0’升级到SwiftyJSON Swift 3.

我们收到此错误

/Users/xxx/Documents/iOS/xxx/Pods/SwiftyJSON/Source/SwiftyJSON.swift:866:33:
Cannot convert return expression of type ‘Int32?’ to return type
‘Int?’

错误在SwiftyJSON.swift的return语句中:

@H_502_11@public var int: Int? { get { return self.number?.int32Value } set { if let newValue = newValue { self.object = NSNumber(value: newValue) } else { self.object = NSNull() } } }

谁知道问题是什么?这是我们的CocoaPods配置还是使用SwiftyJSON的问题?

我只需用下面的代码替换一行代码.简单 @H_502_11@public var int: Int? { get { return self.number?.intValue } set { if let newValue = newValue { self.object = NSNumber(value: newValue) } else { self.object = NSNull() } } }

猜你在找的Swift相关文章