skip to Main Content

I have added Realm and RealmSwift libraries in my iOS project. My app was fine till 2 days back. Suddenly it started giving following error.

Error:Swift package target ‘Realm’ is linked as a static library by ‘Project’ and ‘Realm’, but cannot be built dynamically because there is a package product with the same name.

I don’t find any static libraries in my app. I tried deleting library from Project->Package Dependencies. But XCode is throwing below compiler Error
Missing required modules: ‘Realm.Private’, ‘Realm’, ‘Realm.Swift’

2

Answers


  1. This is likely due to a recent change in the Realm SDK and install setup.

    Please review the Install & Setup Guide.

    If you use Cocoapods, be sure your podfile matches the docs and adjust the iOS/macOS version accordingly.

    platform :ios, '12.0'  //or for macOS use platform :osx, '13.0'
    target 'MyDeviceSDKProject' do
      # Comment the next line if you don't want to use dynamic frameworks
      use_frameworks!
      # Pods for MyDeviceSDKProject
      pod 'RealmSwift', '~>10'
    end
    

    If using SPM, be sure to note the info the Dynamic Framework Section

    To use the Privacy Manifest supplied by the SDK, build RealmSwift as a
    dynamic framework.

    and be sure you’re only adding one package

    Changed in version 10.49.3: Instead of adding both, only add one
    package.

    Select either RealmSwift or Realm, then click Add Package.

    Login or Signup to reply.
  2. For anyone else, as linked to by others, the Install Guide says to link to either Realm or RealmSwift (not too obvious).

    In my case, using SPM, I had to link my target to RealmSwift only.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search