问题
I'm trying to handle a login with the Facebook SDK but I have this error:
2018-08-18 20:50:30.913552+0000 FoodTaskerMobile[1370:39985] TIC TCP Conn Failed [4:0x604000360300]: 1:61 Err(61)
2018-08-18 20:50:30.915921+0000 FoodTaskerMobile[1370:39985] Task <D93AC55D-9E5E-4B25-B48E-5799A19F5F3C>.
<1> HTTP load failed (error code: -1004 [1:61])
This is my class code:
class LoginViewController: UIViewController {
@IBOutlet weak var bLogout: UIButton!
@IBOutlet weak var bLogin: UIButton!
var fbLoginSuccess = false
var userType: String = USERTYPE_CUTOMER
override func viewDidLoad() {
super.viewDidLoad()
if (FBSDKAccessToken.current() != nil) {
bLogout.isHidden = false
FBManagar.getFBUserData(completionHandler: {
self.bLogin.setTitle("Continue as \(User.currentUser.email!)", for: .normal)
// self.bLogin.sizeToFit()
})
}
}
override func viewDidAppear(_ animated: Bool) {
if (FBSDKAccessToken.current() != nil && fbLoginSuccess == true) {
performSegue(withIdentifier: "CustomerView", sender: self)
}
}
I just fixed a canOpenUrl
issue (OSStatus error -10814.) and now error 1004 showed up.
回答1:
I think that this error appears in a real device and not in the simulator, this because the mac has a webserver running and so the simulator can resolve it, not the device (it hasn't a webserver on it).
The 1004 is a URLError.cannotConnectToHost
Try to use the mac ip instead of the localhost, you can try to use the local network ip if the webserver hasn't a public ip. Check if you can resolve the ip from your iPhone and then it should work.
来源:https://stackoverflow.com/questions/51922498/tic-tcp-conn-failed-40x604000360300-161-err61-1-http-load-failed-error