我正在尝试从使用swift在macos上开发的应用程序连接到领域对象服务器
当我尝试连接时,我收到此错误“网络连接丢失”,但我可以从浏览器打开领域服务器没有问题..顺便说一句,这个问题最近发生,它几周前工作正常
let credentials = SyncCredentials.usernamePassword(username: username, password: password)
SyncUser.logIn(with: credentials, server: serverurl) {
user, error in
if let u = user {
onCompletion(syncUser: u, error: nil)
} else if let error = error {
onCompletion(syncUser: nil, error: error)
} else {
onCompletion(syncUser: nil, error: nil)
}
}
在这里,用户始终是nil
,错误描述是Network connection was lost
本地服务器和托管在digitalocean上的服务器都会发生这种情况
服务器版本1.8.3
xcode控制台日志
2018-01-15 12:46:07.077741 + 0300 Oncobase [8138:9497304] ApplePersistence = NO 2018-01-15 12:46:07.207859 + 0300 Oncobase [8138:9497813] dnssd_clientstub ConnectToServer:connect() - >没有尝试:1 2018-01-15 12:46:08.218889 + 0300 Oncobase [8138:9497813] dnssd_clientstub ConnectToServer:connect() - > No of attempts:2 2018-01-15 12:46:09.228932 + 0300 Oncobase [8138:9497813 ] dnssd_clientstub ConnectToServer:connect() - >尝试次数:3 2018-01-15 12:46:10.239595 + 0300 Oncobase [8138:9497813] dnssd_clientstub ConnectToServer:connect()路径失败:/ var / run / mDNSResponder套接字:16错误:-1 Errno:1操作不被允许2018-01-15 12:46:10.239850 + 0300 Oncobase [8138:9497813] [] nw_resolver_create_dns_service_locked DNSServiceCreateDelegateConnection failed:ServiceNotRunning(-65563)2018-01-15 12:46:10.240322+ 0300 Oncobase [8138:9497813] TIC TCP Conn失败[1:0x600000163300]:10:-72000 Err(-65563)2018-01-15 12:46:10.257327 + 0300 Oncobase [8138:9497796]任务。<1> HTTP加载失败(错误代码:-1003 [10:-72000] )2018-01-15 12:46:10.257548 + 0300 Oncobase [8138:9497796]任务。<1>完成错误 - 代码:-1003 2018-01-15 12:46:23.852072 + 0300 Oncobase [8138:9497838] [] nw_socket_connect connectx失败(fd 16,127.0.0.1:9080 stream,pid:8138,sanitized url:http://127.0.0.1:9080/auth):[1]不允许操作2018-01-15 12:46:23.852142 + 0300 Oncobase [8138:9497838] [] nw_socket_get_input_frames recvmsg(fd 16,1024字节):[57]套接字未连接2018-01-15 12:46:23.852284 + 0300 Oncobase [8138:9497838] TIC TCP Conn失败[2:0x600000169b40]:1:57错误(57)2018-01-15 12:46:23.852618 + 0300 Oncobase [8138:9497838]任务<91597B31-6AB4-41BB-A5A6-C32525BC8A67>。<2> HTTP加载失败(错误代码:-1005 [1: 57])2018-01-15 12:46:23.853839 + 0300 Oncobase [8138:9497798]任务<91597B31-6AB4-41BB-A5A6-C32525BC8A67>。<2>完成错误 - 代码:-1005
编辑1:我刚刚启用了沙盒,可以将应用程序上传到苹果应用商店..这可能是问题吗?任何解决方法?
沙盒似乎是真正的问题
我必须启用Ingoing Connections和Outgoing Connections with sandboxing才能使用
你必须离开“App Sandbox”。
转到:xcode Project-> Capabilities - > App SandBoxScreenShot