0

I'm using Realm Swift SDK on my SwiftUI project. It all started when I updated the Realm package in the XCode Package Manager.

I faced some issues with the new version of Realm's Swift SDK and based on the docs - I removed Realm library, kept RealmSwift library, and changed the embed settings to Embed & Sign: here's the Target's General

Now - when I run the app - the realm isn't populated with data. I wish I could just roll back, but it's impossible - I get runtime error when I change RealmSwift to "do not embed":

dyld[13970]: Library not loaded: @rpath/RealmSwift.framework/RealmSwift
 Referenced from: <0C0C4659-D88F-3302-B78E-AEF6E29D9636> /private/var/containers/Bundle/Application/C8216C2A-9D4F-4767-BEE4-70F977B5B509/MindCheckAI.app/MindCheckAI
 Reason: tried: '/Users/itamargil/Library/Developer/Xcode/DerivedData/MindCheckAI-fmefsxngttqathgdnicimkgijggk/Build/Products/Debug-iphoneos/PackageFrameworks/RealmSwift.framework/RealmSwift' (no such file), '/private/preboot/Cryptexes/OS/Users/itamargil/Library/Developer/Xcode/DerivedData/MindCheckAI-fmefsxngttqathgdnicimkgijggk/Build/Products/Debug-iphoneos/PackageFrameworks/RealmSwift.framework/RealmSwift' (no such file), '/private/var/containers/Bundle/Application/C8216C2A-9D4F-4767-BEE4-70F977B5B509/MindCheckAI.app/Frameworks/RealmSwift.framework/RealmSwift' (no such file), '/Users/itamargil/Library/Developer/Xcode/DerivedData/MindCheckAI-fmefsxngttqathgdnicimkgijggk/Build/Products/Debug-iphoneos/PackageFrameworks/RealmSwift.framework/RealmSwift' (no such file), '/private/preboot/Cryptexes/OS/Users/itamargil/Library/Developer/Xcode/DerivedData/MindCheckAI-fmefsxngttqathgdnicimkgijggk/Build/Products/Debug-iphoneos/PackageFrameworks/RealmSwift.framework/RealmSwift' (no such file), '/private/var/containers/Bundle/Application/C8216C2A-9D4F-4767-BEE4-70F977B5B509/MindCheckAI.app/Frameworks/RealmSwift.framework/RealmSwift' (no such file)
  1. I made sure that the user exists, and that the user ID is found when the realm is bootstrapped.
  2. I checked logs - now there are no permissions to read/write (whereas before the change there were). Before:
Logs:
[
 "Roles selected for sync:",
 " readAndWriteAll: [ Analysis, Answers, Explainer, Form, NotificationPreferences, User ]"
]
Function Call Location:
DE-FF
Query:
{
 "Explainer": "(TRUEPREDICATE)",
 "Form": "((isPublic == true or creatorID == \"654a172a09bd5f2f6c1d49f0\"))",
 "NotificationPreferences": "(receiver_id == oid(654a172a09bd5f2f6c1d49f0))",
 "User": "(_id == oid(654a172a09bd5f2f6c1d49f0))",
 "Analysis": "(respondent_id == oid(654a172a09bd5f2f6c1d49f0))",
 "Answers": "(respondent_id == oid(654a172a09bd5f2f6c1d49f0))"
}
Remote IP Address:
189.62.45.236
SDK:
Realm Swift v10.42.4
Platform:
iOS vVersion 17.3.1 (Build 21D61)

After:

Function Call Location:
DE-FF
Query:
{}
Remote IP Address:
189.62.45.236
SDK:
Realm Swift v10.50.0
Platform:
iOS vVersion 17.4.1 (Build 21E236)
3
  • Welcome to SO. First, did you check to see if there was a file (it would actually be an alias) at '/Users/itamargil/Library/Developer/Xcode/DerivedData/MindCheckAI-fmefsxngttqathgdnicimkgijggk/Build/Products/Debug-iphoneos/PackageFrameworks/RealmSwift.framework/RealmSwift'. Then, you may want to pod deintegrate and then re-add Realm. It also seems you may not be authenticated (correctly). Can you log out the user and log them back in? Commented May 7, 2024 at 18:36
  • Probably unrelated but check my answer the this question and see if making those adjustments help at all. Commented May 8, 2024 at 18:39
  • For reference, the Realm v10.50.0 install release provides guidance on how to install the correct version. Targets must now depend on only Realm or RealmSwift. If you use both the obj-c and swift API, depending on RealmSwift will let you import Realm. - it's noted in the install guide as well: Changed in version 10.49.3: Instead of adding both, only add one package. Select either RealmSwift or Realm, then click Add Package. Commented May 9, 2024 at 17:12

1 Answer 1

0

So I actually figured out the issue; it was the SDK versioning.

By removing Realm package and adding again with default version settings things went back to normal.

This issue was a bummer. My conclusion is (for Realm Swift SDK):

  1. Only use RealmSwift package, not Realm.
  2. Don't mess with the package settings; just add it with the default ones.
answered May 9, 2024 at 4:23
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.