Xcode是給我一個愚蠢的錯誤是沒有意義的:的Xcode讓愚蠢的錯誤,就沒有任何意義
let command = ["", "", ""]
let task = NSTask()
task.arguments = command[1...command.count-1]
Error: Cannot subscript a value of type '[String]'
跆拳道!??
如果我把它分解:
let command = ["", "", ""]
let a = command[1...command.count-1]
let task = NSTask()
task.arguments = a
Error: Cannot assign value of type 'ArraySlice' to type '[String]?'
爲什麼Xcode的身體不能產生錯誤信息,使意義的?當然,原始代碼並不是那麼複雜,以至於不能編譯器!
此外,爲什麼我不能將一個ArraySlice分配給一個Array類型的變量?