gpt4 book ai didi

ios - 在Objective-C中将图表与 Realm 一起使用

转载 作者:行者123 更新时间:2023-12-01 18:42:57 25 4
gpt4 key购买 nike

我的项目主要是用Objective-C编写的,并且我在其中使用Realm。
我想添加具有领域支持的Charts库,但是在尝试使用cocoapods添加它时出现错误。

Podfile看起来像这样(带有其他一些库)

platform :ios, '9.0'
use_frameworks!

target 'MY_PROJECT' do
pod 'Realm'
pod 'Charts/Realm'
end

我得到的错误是:
[!] Unable to satisfy the following requirements:

- `Realm` required by `Podfile`
- `Realm` required by `Podfile`
- `Realm` required by `Podfile`
- `Realm (= 2.0.0)` required by `Podfile.lock`
- `Realm (= 0.97.0)` required by `RealmSwift (0.97.0)`

由于我的项目混合在一起,因此无法直接使用RealmSwift。
有任何想法吗?

最佳答案

问题不在于混合Realm和RealmSwift。您似乎先安装了没有图表的Realm,然后将图表添加到Podfile,然后添加pod install,对吗?因此,Podfile.lock(文件固定库到特定版本)将Realm固定到2.0.0,但是Charts需要较旧版本的RealmSwift(RealmSwift隐式依赖于Realm)。这就是错误的原因。

要解决此问题,您可以执行pod update或仅从Podfile中删除pod 'Realm'。两种方法都可以删除Realm 2.0,然后安装Realm和RealmSwift 1.1.0(必须使用Chart 1.1.0)。

您不能使用更高版本的Realm,因为Charts需要1.1.0。

关于ios - 在Objective-C中将图表与 Realm 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40322926/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com