求大神解答一下,success和failure,在我的Xcode6 beta2里一直报错,有以下几个错:
manager.GET(url,
parameters: params,
success: { (operation: AFHTTPRequestOperation!,
responseObject: AnyObject!) in
println("JSON: " + responseObject.description!)
self.updateUISuccess(responseObject as NSDictionary!)
},
failure: { (operation: AFHTTPRequestOperation!,
error: NSError!) in
println("Error: " + error.localizedDescription)
self.loading.text = "Internet appears down!"
})
1. 是不是必须写'in println()' , 否则s会报错
2. success里面写'in println()', 编译器就崩溃了,会有一大片内存的报错信息
3. 要是这样写
success: { (operation: AFHTTPRequestOperation!, responseObject: AnyObject!)
self.updateUISuccess(responseObject as NSDictionary!)},
failure: { (operation: AFHTTPRequestOperation!,error: NSError!) in println("hello")})
在success的左大括号处报Function produces expected type '((AFHTTPRequestOperation!, AnyObject!) -> Void)!'; did you mean to call it with '()'?
4. 要是这样写
success: { (operation: AFHTTPRequestOperation!, responseObject: AnyObject!)
self.updateUISuccess(responseObject as NSDictionary!)},
failure: { (operation: AFHTTPRequestOperation!, error: NSError!) })
在failure的AFHTTPRequestOperation和NSError都报:Expected member name or constructor call after type name