Realm-cocoa: Apple Watch Sandbox

Created on 10 Dec 2017  路  7Comments  路  Source: realm/realm-cocoa

Goals

Use realm swift in an apple watch app

Expected Results

It should work ?

Actual Results

The sandbox of the apple watch prevents the connection to the realm.

Steps to Reproduce

Create an apple watch app and try to connect to a realm with it on a real device. It works on the simulator but not on a real device.

This is what you will get:

2017-12-10 12:50:24.432939+0100 RealmAWBug WatchKit Extension[373:540595] dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
2017-12-10 12:50:24.560815+0100 RealmAWBug WatchKit Extension[373:540433] Unbalanced calls to begin/end appearance transitions for <PUICNavigationController: 0x162f1a00>.
2017-12-10 12:50:25.438822+0100 RealmAWBug WatchKit Extension[373:540595] dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
2017-12-10 12:50:26.443064+0100 RealmAWBug WatchKit Extension[373:540595] dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
2017-12-10 12:50:27.448825+0100 RealmAWBug WatchKit Extension[373:540595] dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:14 Err:-1 Errno:1 Operation not permitted
Sync: Connection[1]: Failed to resolve 'Your address': Host not found (authoritative)

Code Sample


https://github.com/TheNoim/RealmAWBug
It dose not really depends on code. But here is an example project
This is what I found: https://stackoverflow.com/questions/41219976/apple-watch-kit-wouldnt-fetch-image

Version of Realm and Tooling

ProductName:    Mac OS X
ProductVersion: 10.13.1
BuildVersion:   17B1003

/Applications/Xcode.app/Contents/Developer
Xcode 9.2
Build version 9C40b

/usr/local/bin/pod
1.4.0.beta.2
Realm (3.0.2)
RealmSwift (3.0.2)

/bin/bash
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin17)

carthage not found
(not in use here)

/usr/local/bin/git
git version 2.15.0
O-Community Pipeline-Idea-Backlog T-Help

Most helpful comment

watchOS 6.0 adds support for URLSessionWebSocketTask. It sounds like sync should be possible now.

@realm-support Any idea when we could see sync support on watchOS?

All 7 comments

Sorry for the delay in responding, @TheNoim.

The only networking that watchOS permits directly from the device is HTTP requests made via NSURLSession. Realm Platform's synchronization protocol is based on WebSockets and so cannot be implemented on top of NSURLSession in a way that's compatible with watchOS. This unfortunately means you'll need to limit your use of Realm Platform to your iOS app, and communicate data to your watchOS app via the Watch Connectivity framework.

Is there any way that to tell Realm to not try so that these messages stop showing up in the logs?

@bdash I recently discovered a web socket swift library supporting watch os. It seems like websockets are possible on an apple watch.

Is there any way that to tell Realm to not try so that these messages stop showing up in the logs?

Getting the same error code on my Mac App, and I have the same concern. I guess it is related to realm cloud stuff(not sure), but cannot find a related doc. Can somebody show how to turn it off?

watchOS 6.0 adds support for URLSessionWebSocketTask. It sounds like sync should be possible now.

@realm-support Any idea when we could see sync support on watchOS?

If you have a feature request please add it here:
https://feedback.mongodb.com/

I'm getting similar errors with a Mac app. I'm intending to just use it locally and don't want to allow outgoing requests. Is there a way to tell realm to not make the requests?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

i-schuetz picture i-schuetz  路  3Comments

dmorrow picture dmorrow  路  3Comments

duribreux picture duribreux  路  3Comments

dennisgec picture dennisgec  路  3Comments

jpsim picture jpsim  路  3Comments