Does MongoDB Realm Beta Sync work on macOS clients?

I’ve been trying to get a macOS app work with MongoRealm Sync.

I’ve set up the backend, I’ve tried creating a user and logging in from an iOS client.

It worked.

Now I’m trying to make the same code work on a macOS client.

When I’m logging a user in I’m getting the following error message:

2020-06-12 16:39:22.331146+0700 MongoRealmApp1[70396:1756850] dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:5 Err:-1 Errno:1 Operation not permitted

2020-06-12 16:39:22.335923+0700 MongoRealmApp1[70396:1756850] [] nw_resolver_create_dns_service_locked [C1] DNSServiceCreateDelegateConnection failed: ServiceNotRunning(-65563)

2020-06-12 16:39:22.336530+0700 MongoRealmApp1[70396:1756850] Connection 1: received failure notification

2020-06-12 16:39:22.336595+0700 MongoRealmApp1[70396:1756850] Connection 1: failed to connect 10:-72000, reason -1

2020-06-12 16:39:22.336637+0700 MongoRealmApp1[70396:1756850] Connection 1: encountered error(10:-72000)

2020-06-12 16:39:22.345752+0700 MongoRealmApp1[70396:1756850] Task <C6E8F1BF-F3E6-4BCA-A2FA-CB664D2B4EE0>.<1> HTTP load failed, 0/0 bytes (error code: -1003 [10:-72000])

2020-06-12 16:39:22.352272+0700 MongoRealmApp1[70396:1756849] Task <C6E8F1BF-F3E6-4BCA-A2FA-CB664D2B4EE0>.<1> finished with error [-1003] Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo={_kCFStreamErrorCodeKey=-72000, NSUnderlyingError=0x600000c7fb10 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 "(null)" UserInfo={_kCFStreamErrorCodeKey=-72000, _kCFStreamErrorDomainKey=10}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <C6E8F1BF-F3E6-4BCA-A2FA-CB664D2B4EE0>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(

"LocalDataTask <C6E8F1BF-F3E6-4BCA-A2FA-CB664D2B4EE0>.<1>"

), NSLocalizedDescription=A server with the specified hostname could not be found., NSErrorFailingURLStringKey=https://stitch.mongodb.com/api/client/v2.0/app/testappone-ncerb/location, NSErrorFailingURLKey=https://stitch.mongodb.com/api/client/v2.0/app/testappone-ncerb/location, _kCFStreamErrorDomainKey=10}

Login failed: Error Domain=realm::app::JSONError Code=2 "[json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - invalid literal; last read: 'A'" UserInfo={realm::app::JSONError=malformed json, NSLocalizedDescription=[json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - invalid literal; last read: 'A'}
1 Like

@Alexei_Vinidiktov Can you share the version of RealmSwift you are using, The version of macOS, and a snippet of code showing how you are trying to login?

@Alexei_Vinidiktov

We you able to go through the entire process of Creating a Realm App via the Atlas console of the MongoDB website? You said the iOS app worked so I assume you were but we’re having some challenges with that so just checking.

macOS 10.15.4
RealmSwift 10.0.0-beta.2
The following code works fine in my iOS app, but it gives an error on macOS. Registering a user also works on IOS, but not on macOS.

struct Constants {
    // Set this to your Realm App ID found in the Realm UI.
    static let REALM_APP_ID = "<my app id>"
}
let app = RealmApp(id: Constants.REALM_APP_ID)

app.login(withCredential: AppCredentials(username: "test", password: "123456")) { [weak self](user, error) in
                    DispatchQueue.main.sync {
                        guard error == nil else {
                            print("Login failed: \(error!)");
                            return
                        }

                        print("Login succeeded!");
                    }
                };

We you able to go through the entire process of Creating a Realm App via the Atlas console of the MongoDB website?
Yes.

You said the iOS app worked so I assume you were but we’re having some challenges with that so just checking.
Yes. My iOS app is able to register and login users.

The same code results in an error on macOS.

I’m just starting with MongoDb Realm. I’m experimenting with iOS and macOS.

I’ve figured it out. I had to add the “Outgoing connections (client)” capability in the Signing and Capabilities -> App Sandbox section of my Xcode project.

So now logging users in works on macOS.

1 Like

What Code you have writeen for sync the collection data?

Thanks anyway