问题
I am following the steps given here to build realm to be used in an iOS project, I am using Xcode 8 beta 3 :
I get these warnings :
ld: warning: ignoring file .../Realm.framework/Realm, missing required architecture x86_64 in file .../Realm.framework/Realm (2 slices)
ld: warning: ignoring file .../RealmSwift.framework/RealmSwift, missing required architecture x86_64 in file .../RealmSwift.framework/RealmSwift (2 slices)
and this error
Lipo: -remove's specified would result in an empty fat file
Why is this happening?
回答1:
Can you try these updated instructions, which should work for Beta 3?
- Clone the Realm Cocoa git repository:
git clone https://github.com/realm/realm-cocoa.git - Open the Xcode project. Click on the
Realmproject, then theRealmSwifttarget, then the 'Build Settings' tab, and setUse Legacy Swift Language VersiontoYes(if building for Swift 2.3) orNo(if building for Swift 3). - From the directory containing the git repository, run the following command:
sh build.sh TARGET, whereTARGETis one of the following:ios-swift,osx-swift,tvos-swift, orwatchos-swift, depending on what platform you are building for. - Once the build has completed, go to the 'build' directory, then the directory named after the platform for which you built (e.g. 'ios').
- Open the 'swift-2.3' or 'swift-3.0' directory (depending on which version you built for).
- Drag
RealmSwift.frameworkandRealm.frameworkinto your project, as per step 2 in the instructions here, and do steps 3 and 4.
If these don't work please do post a comment.
回答2:
In order to get Swift 3 versions of Realm and RealmSwift, I had to explicitly target master, set submodules to true, and include a post_install hook to set the Swift version:
use_frameworks!
target 'TARGET_NAME' do
pod 'Realm', git: 'https://github.com/realm/realm-cocoa.git', branch: 'master', submodules: true
pod 'RealmSwift', git: 'https://github.com/realm/realm-cocoa.git', branch: 'master', submodules: true
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
end
回答3:
You need to install Realm using Cocoapods and this pods:
pod 'Realm', git: 'https://github.com/realm/realm-cocoa.git', branch: 'master'
pod 'RealmSwift', git: 'https://github.com/realm/realm-cocoa.git', branch: 'master'
and while running the application don't select convert to swift 3
来源:https://stackoverflow.com/questions/38696369/build-realm-for-swift-3-xcode-8