I’m almost 100% sure the root cause of this issue is not coming from Realm, but the resulting problem is affecting Realm, so I’ll post it here.
The thing is that I have an app with two versions.
Version 1. The app is unsigned. When I install it, it looks like the contents of the app are located at ~/Library/Containers/com.dgrcode.{appName}/Data/. Then, I can locate the default.realm file at the container path + (.../Data)/Library/Application Support/default.realm
Version 2. The app is signed with a “Personal Team” certificate manually with the command codesign -v --sign .... It looks like the contents of the app are located at ~/.
I’m not sure why this happens (I’ve asked on StackOverflow and Apple Developer Forums, but no luck). But still, the problem is that I can’t locate default.realm inside ~/Library/Application Support/default.realm. It’s not there
The Mac search can’t find even one of them, so also not very helpful.
Now the weird part is that if I don’t sign version 2, it still uses ~/Library/Containers/com.dgrcode.{appName}/Data.
My two questions are:
Where could the default.realm be located when I use the signed version 2?
Have you ever seen a scenario where just signing the .app changes the location of the default realm ?
I then turned on Automatically manage signing & sign to run locally. I ran the project again and clicked the button. The file at that same location was updated.
Lastly, I set it to use a Team and ran again. Same file, same location.
If you’re using sandboxing, then containers is where the data would go but in the above testing, the default.realm file location does not change with or without signing.
With sandboxing on, I did the exact same test and data with and without signing was written to