let url = URL(string: "\(SERVER_HOST)/post?fb_id=\(fb_user)")
var request = URLRequest(url: url!) // Crashes here
Alamofire.request(request)
.responseJSON { response in
switch response.result {
case .failure(let error):
onComplete(success: false)
case .success(let responseObject):
onComplete(success: true)
}
}
崩溃错误:
致命错误:在展开可选值时意外发现 nil
它在 Swift 3 之前有效。
它是 NSURLRequest 并且有效。我该怎么做才能修复它?