我在ubuntu16.04上安装了Swift4.1。
完成安装后,我运行swift build发现一些错误
Compile Swift Module 'PerfectTemplate' (15 sources)
/home/ubuntu/PttTrader/Sources/MinuteRepeat.swift:368:13: warning: variable 'idxx' was never mutated; consider changing to 'let' constant
var idxx = phoneModels[idx].idx!
~~~ ^
let
/home/ubuntu/PttTrader/Sources/PTTManager + Extension.swift:44:161: error: type 'CFStringEncodings' (aka 'Int') has no member 'big5'
if let response = String(data: messageMenuData , encoding: String.Encoding(rawValue: CFStringConvertEncodingToNSStringEncoding(CFStringEncoding(CFStringEncodings.big5.rawValue)))) {
^~~~~~~~~~~~~~~~~ ~~~~
/home/ubuntu/PttTrader/Sources/PTTManager + Extension.swift:115:161: error: type 'CFStringEncodings' (aka 'Int') has no member 'big5'
if let response = String(data: messageMenuData , encoding: String.Encoding(rawValue: CFStringConvertEncodingToNSStringEncoding(CFStringEncoding(CFStringEncodings.big5.rawValue)))) {
^~~~~~~~~~~~~~~~~ ~~~~
/home/ubuntu/PttTrader/Sources/PTTManager + Extension.swift:137:25: error: use of unresolved identifier 'arc4random_uniform'
let randomNum = arc4random_uniform(3)
^~~~~~~~~~~~~~~~~~
/home/ubuntu/PttTrader/Sources/PTTManager + Extension.swift:258:161: error: type 'CFStringEncodings' (aka 'Int') has no member 'big5'
if let response = String(data: messageMenuData , encoding: String.Encoding(rawValue: CFStringConvertEncodingToNSStringEncoding(CFStringEncoding(CFStringEncodings.big5.rawValue)))) {
^~~~~~~~~~~~~~~~~ ~~~~
/home/ubuntu/PttTrader/Sources/PTTManager + Extension.swift:314:161: error: type 'CFStringEncodings' (aka 'Int') has no member 'big5'
if let response = String(data: messageMenuData , encoding: String.Encoding(rawValue: CFStringConvertEncodingToNSStringEncoding(CFStringEncoding(CFStringEncodings.big5.rawValue)))) {
^~~~~~~~~~~~~~~~~ ~~~~
/home/ubuntu/PttTrader/Sources/PTTManager + Extension.swift:188:165: error: type 'CFStringEncodings' (aka 'Int') has no member 'big5'
if let response = String(data: messageMenuData , encoding: String.Encoding(rawValue: CFStringConvertEncodingToNSStringEncoding(CFStringEncoding(CFStringEncodings.big5.rawValue)))) {
^~~~~~~~~~~~~~~~~ ~~~~
/home/ubuntu/PttTrader/Sources/PTTManager + Extension.swift:229:165: error: type 'CFStringEncodings' (aka 'Int') has no member 'big5'
if let response = String(data: messageMenuData , encoding: String.Encoding(rawValue: CFStringConvertEncodingToNSStringEncoding(CFStringEncoding(CFStringEncodings.big5.rawValue)))) {
^~~~~~~~~~~~~~~~~ ~~~~
error: terminated(1): /swift-4.1/usr/bin/swift-build-tool -f /home/ubuntu/PttTrader/.build/debug.yaml main output:
上面说'type'CFStringEncodings'(aka'Int')没有成员'big5',但是当我在本地xcode中运行相同的代码时,就可以了。
有人可以告诉我如何解决吗?或替换“ CFStringEncodings”功能的某种方式。
非常感谢您。