我正在使用 Swift2.0 制作 iOS 应用。
我尝试通过 CocoaPod 安装 Realm 库。
当我在命令行中执行'pod install'时没问题。
但是在 Xcode 项目中,我无法构建我的 iOS 应用。
出现错误,停止构建。
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool: can't open file: /Users/satoutakeshi/Library/Developer/Xcode/DerivedData/AlermMA-hczduhcpoaudvlgzjrzioeecipfh/Build/Products/Debug-iphonesimulator/AlermMA.app/Frameworks/Realm.framework/Realm (No such file or directory)
这是我的 Podfile
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'RealmSwift'
我应该如何安装 Realm?
谢谢!
最佳答案
您可能会看到此错误,因为在混合的 Objective-C/Swift 应用程序中不支持使用 RealmSwift
pod。尝试使用 Objective-C Realm pod:
pod 'Realm'
你仍然可以在你的 Swift 文件中使用 Realm,你只需要将 Objective-C 语法转换为 Swift,当然,RealmSwift
中的 Swift 独有的东西赢了有空。
关于ios - 无法在 Swift 2.0 中通过 CocoaPods 安装 Realm 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33029312/