realm / realm-browser-osx

DEPRECATED - Realm Browser for Mac OS X has been replaced by realm-studio which is cross platform.
https://realm.io
502 stars 54 forks source link

Realm browser opening file in iOS Simulator Documents directory of App fails #239

Closed Ryce closed 7 years ago

Ryce commented 7 years ago

Goals

To open the Realm file in the Realm browser while Simulator is accessing the file. It works when I copy the file on Desktop and execute the realm browser there. I also tried setting permissions to the Folder itself and logged in as root. None of that worked

-- update

I tried using the brew version of Realm Browser (Version 2.0.0). Same issue there

Expected results

To open the Realm file in the Realm browser

Actual results

The document “default.realm” could not be opened.

Steps to reproduce

  1. Run App in Simulator
  2. set breakpoint where RealmSwift is being imported
  3. execute po Realm().configuration()
  4. copy file path of default.realm file
  5. open in Terminal
  6. double click on realm file
  7. Hit Allow when asked for permission to access the file path
  8. see: The document “default.realm” could not be opened.

Code sample that highlights the issue (full Xcode projects that we can compile ourselves are ideal) N/A Version of Realm/Xcode/OSX 2.1.0 (Both on the browser and realm-cocoa) / Version 8.1 (8B62) / Sierra 10.12.1 (16B2657)

TimOliver commented 7 years ago

Hey @Ryce! Thanks for the bug report!

Just to confirm, which iOS device was the Simulator set to when you tried to open it in the Browser?

Ryce commented 7 years ago

@TimOliver iPad Retina

TimOliver commented 7 years ago

@Ryce Okay, thanks for that!

That particular simulator represents the 4th Generation iPad which was the final iPad to use a 32-bit SoC as opposed to 64-bit.

Realm isn't able to share access to a Realm file from two processes that represent different architectures. So while it's possible to view the contents of a Realm file in the Browser simultaneously from Simulator instances representing 64-bit devices (e.g., iPad Air and Phone 5s and above), it simply will not work with 32-bit devices.

This is a limitation of how Realm shares cross-process access to its files and isn't a priority for us to fix (As there's no chance of this ever happening in production).

That being said, the Browser used to actually display a message explaining this issue. It seems to be a regression that it's now displaying a generic "Document couldn't be opened" message. I'll file another issue to make sure the appropriate error message is displayed.

For now, I recommend running simply running your app in an iOS Simulator representing a 64-bit device. You'll need to exit out of the Simulator if you wish to view the Realm's contents from a 32-bit device.

I hope that helped!

Ryce commented 7 years ago

Hey @TimOliver thanks, I will try with 64 Bit SoC Simulators. Much appreciated for the help

// EDIT

it works, thanks!

stel commented 7 years ago

Yes, we need to check error messages, there is already and issue for that: https://github.com/realm/realm-browser-osx/issues/220, so will close this for now.