Watch keynotes and sessions from MongoDB.live, our virtual developer conference.

Sync not working

I’m following the getting Tasks app tutorials. Each time I quit the tasks app and restart it. The list is populated with tasks, but syncing does not work. Sync only works the first time the app runs. In order to get it working again, I have to delete the app from my device and relaunch it. As long as the app is running for the first time sync works. Any ideas?

The following is printed to the console:

Sync: Connection[2]: Websocket: Expected HTTP response 101 Switching Protocols, but received:

HTTP/1.1 404 Not Found

Cache-Control: no-cache, no-store, must-revalidate

Content-Length: 4

Content-Type: text/plain; charset=utf-8

Date: Mon, 15 Jun 2020 02:44:13 GMT

Vary: Origin

X-Content-Type-Options: nosniff

X-Frame-Options: DENY

404

We need to know what platform you’re using, how your authentication is set up (and the code) and then how you’re connecting to Realm (code). So we really need to see some code.

After some trial and error I discovered this to be specific to my iPhone. Since it was not occurring in the iOS simulator or on another iOS device I tired.

I’m using iOS 13.5.1 and Xcode 11.5 (11E608c)

The code was direct from the tutorial.

I was able to rectify the problem by deleting the tutorial task app from the iPhone, restarting the iPhone then reinstalling the task app. It appears to be working normally now.

Hello @Rob_Cummings,

What are you passing for “Partition”?

Can you please share iOS snippet code if possible?

Thanks in advance.

Sorry guys, I got it working as described in previous post. I’ve since deleted to tutorial project.