I am trying to connect into realm object server from an app developed with swift on macos
When I try to connect, I get this error "Network connection was lost", but I can open the realm server from the browser without a problem.. btw, this problem happened recently, it was working correctly few weeks ago
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)
}
}
Here, user is always nil
and the error description is Network connection was lost
This happens with both a local server and one hosted on digitalocean
Server version 1.8.3
xcode console log
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()-> No of tries: 1 2018-01-15 12:46:08.218889+0300 Oncobase[8138:9497813] dnssd_clientstub ConnectToServer: connect()-> No of tries: 2 2018-01-15 12:46:09.228932+0300 Oncobase[8138:9497813] dnssd_clientstub ConnectToServer: connect()-> No of tries: 3 2018-01-15 12:46:10.239595+0300 Oncobase[8138:9497813] dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:16 Err:-1 Errno:1 Operation not permitted 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 Failed [1:0x600000163300]: 10:-72000 Err(-65563) 2018-01-15 12:46:10.257327+0300 Oncobase[8138:9497796] Task .<1> HTTP load failed (error code: -1003 [10:-72000]) 2018-01-15 12:46:10.257548+0300 Oncobase[8138:9497796] Task .<1> finished with error - code: -1003 2018-01-15 12:46:23.852072+0300 Oncobase[8138:9497838] [] nw_socket_connect connectx failed (fd 16, 127.0.0.1:9080 stream, pid: 8138, sanitized url: http://127.0.0.1:9080/auth): [1] Operation not permitted 2018-01-15 12:46:23.852142+0300 Oncobase[8138:9497838] [] nw_socket_get_input_frames recvmsg(fd 16, 1024 bytes): [57] Socket is not connected 2018-01-15 12:46:23.852284+0300 Oncobase[8138:9497838] TIC TCP Conn Failed [2:0x600000169b40]: 1:57 Err(57) 2018-01-15 12:46:23.852618+0300 Oncobase[8138:9497838] Task <91597B31-6AB4-41BB-A5A6-C32525BC8A67>.<2> HTTP load failed (error code: -1005 [1:57]) 2018-01-15 12:46:23.853839+0300 Oncobase[8138:9497798] Task <91597B31-6AB4-41BB-A5A6-C32525BC8A67>.<2> finished with error - code: -1005
Edit 1: I have just enabled sandboxing to be able to upload the app into apple app store.. could this be the issue? any workaround?
It seems sandboxing was the real problem
I had to enable Ingoing Connections and Outgoing Connections with sandboxing for this to work