That’s it. Since the project is relatively simple, Alamofire is no longer needed on the network side. I wrote NSURLSession myself
private func requestWithParameters(method:Method = .GET, parameters:[String:AnyObject], url:String ,completeHandle:(Bool,AnyObject?,NSError?) ->Void)
{
let url = NSURL(string: url)
//set up request
let request = NSMutableURLRequest(URL:url!)
request.timeoutInterval = 15
request.HTTPMethod = method.rawValue
//set up parameters
print("parameters:\(parameters)")
var param = "?"
for item in parameters {
if item.1 is String{
param += item.0 + "=" + (item.1 as! String) + "&"
}else{
param += item.0 + "=" + String(format: "%i",item.1 as! Int) + "&"
}
}
Half of the code in the request is as above because one of the parameters is of type Int. Suddenly I don’t know how to splice the request parameters. I can’t turn my head around. The above writing is wrong. Please help me. Write. . .