realm / realm-swift

Realm is a mobile database: a replacement for Core Data & SQLite
https://realm.io
Apache License 2.0
16.25k stars 2.14k forks source link

XCFramework compitability issue with Xcode #8658

Closed TahaMahmoud closed 1 month ago

TahaMahmoud commented 1 month ago

How frequently does the bug occur?

Always

Description

I tried to integrate Realm into a project as XCFramework, I downloaded the XCFramework file here RealmSwift@15.3.spm.zip

This approach works fine using Xcode Version 15.3 But as expected, It doesn't work on Xcode version 15.4 And gives this error

Cannot load module 'RealmSwift' built with SDK 'iphonesimulator17.4' when using SDK 'iphonesimulator17.5': /Users/TahaMahmoud/Library/Developer/Xcode/DerivedData/{Project_Name}- ekjbxvcgmrzqymeemnnceukjmpvv/Build/Products/Debug-iphonesimulator/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm64-apple-ios-simulator.swiftmodule

But the issue is the team members have different versions of Xcode, So I need a way to integrate Realm as XCFramework instead of SPM, And at the same time, it works with different versions of Xcode.

Stacktrace & log output

Cannot load module 'RealmSwift' built with SDK 'iphonesimulator17.4' when using SDK 'iphonesimulator17.5': /Users/TahaMahmoud/Library/Developer/Xcode/DerivedData/{Project_Name}-
> ekjbxvcgmrzqymeemnnceukjmpvv/Build/Products/Debug-iphonesimulator/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm64-apple-ios-simulator.swiftmodule

Can you reproduce the bug?

Always

Reproduction Steps

No response

Version

v10.52.2

What Atlas Services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

iOS (15 as a minimum version)

Build environment

Xcode version: ... Dependency manager and version: ...

sync-by-unito[bot] commented 1 month ago

➤ PM Bot commented:

Jira ticket: RCOCOA-2414

amirpervaizQI commented 1 month ago

@TahaMahmoud you need to compile XCFramework with library evolution support BUILD_LIBRARY_FOR_DISTRIBUTION = YES https://www.swift.org/blog/library-evolution/