iOS 模拟器运行不能联网 PAC Fetch failed with error
app在模拟器是哪个启动成功会自动连接服务器,然后Xcode控制台报错,
模拟器 PAC Fetch failed with error [NSURLErrorDomain:-1001]
这类问题有好多类似的错误代码,看英文可以大概知道他的意思,-1001 代码是超时之类的错误。PAC 是 (代理自动配置),然后我们可以在系统偏好设置->网络->高级->代理 发现有代理错误。可以发现如果有比较诡异的代理,需要手动清除,或者是你开了科学上网自动代理的工具。请先退出这些软件,然后再用模拟器打开app,可以正常联网了。PAC错误的日志可能还在。不过-1001错误消失了。
kCFURLErrorUnknown = -998,
kCFURLErrorCancelled = -999,
kCFURLErrorBadURL = -1000,
kCFURLErrorTimedOut = -1001,
kCFURLErrorUnsupportedURL = -1002,
kCFURLErrorCannotFindHost = -1003,
kCFURLErrorCannotConnectToHost = -1004,
kCFURLErrorNetworkConnectionLost = -1005,
kCFURLErrorDNSLookupFailed = -1006,
kCFURLErrorHTTPTooManyRedirects = -1007,
kCFURLErrorResourceUnavailable = -1008,
kCFURLErrorNotConnectedToInternet = -1009,
kCFURLErrorRedirectToNonExistentLocation = -1010,
kCFURLErrorBadServerResponse = -1011,
kCFURLErrorUserCancelledAuthentication = -1012,
kCFURLErrorUserAuthenticationRequired = -1013,
kCFURLErrorZeroByteResource = -1014,
kCFURLErrorCannotDecodeRawData = -1015,
kCFURLErrorCannotDecodeContentData = -1016,
kCFURLErrorCannotParseResponse = -1017,
kCFURLErrorInternationalRoamingOff = -1018,
kCFURLErrorCallIsActive = -1019,
kCFURLErrorDataNotAllowed = -1020,
kCFURLErrorRequestBodyStreamExhausted = -1021,
kCFURLErrorFileDoesNotExist = -1100,
kCFURLErrorFileIsDirectory = -1101,
kCFURLErrorNoPermissionsToReadFile = -1102,
kCFURLErrorDataLengthExceedsMaximum = -1103,