突然,我开始得到运行时错误,因为,
fatal error: NSArray element failed to match the Swift Array Element type
Run Code Online (Sandbox Code Playgroud)
我宣布我的阵列为,
var myArray : [CUSTOM_CLASS] = [CUSTOM_CLASS]()
Run Code Online (Sandbox Code Playgroud)
现在,在我的服务器响应成功块中,
self.myArray = dicResponse["data"]! as Array
println(self.myArray) // FATAL ERROR HERE
Run Code Online (Sandbox Code Playgroud)
在升级到Xcode6 Beta6之前,这是完美的
FYI : dicResponse["data"]! // is verified as valid
Run Code Online (Sandbox Code Playgroud)
(抱歉指向错误的地方!)
解决了 :
不知道,但我做了一些改变,它的工作原理,
var myArray = [AnyObject]()
self.myArray = dicResponse["data"]! as [AnyObject]
Run Code Online (Sandbox Code Playgroud)