0
내가 스위프트의 새로운 그리고 난이 코드에 대한 솔루션을 찾을 수 없습니다 : 나는 그것을 건설 할 때 나는 "스레드 1 : 신호 SIGABRT"이HTTP 요청과 조건 2
func presentationlum() {
let request = NSMutableURLRequest(URL: NSURL(string: "http://raspberrypi.local/etatlum.php")!)
let Session = NSURLSession.sharedSession()
request.HTTPMethod = "GET"
var JsonDict=NSArray()
let dem = Session.dataTaskWithRequest(request, completionHandler: {data, response, error -> Void in
do{
JsonDict = try! NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions(rawValue: 0))as! NSArray
}
print(JsonDict)
})
dem.resume()
if JsonDict[0] as! String == "0"
{
print("it works !")
}
else
{
print("it works to !")
}
}
을 오류 . 서버가 0
또는 1
(예 : ["1","0","0","1","0"]
) 만 Json_encode 배열을 보냅니다. 저는이 응답을 받고 그것을 조건으로하고 싶지만 그럴 수는 없습니다. 도와주세요.