Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift3 添加图表时出现问题_Swift3_Cocoapods - Fatal编程技术网

Swift3 添加图表时出现问题

Swift3 添加图表时出现问题,swift3,cocoapods,Swift3,Cocoapods,我是swift新手,我正在尝试使用pod添加图表- pod 'Charts', :git=> 'https://github.com/danielgindi/Charts.git' 在添加图表后,我发现了以下问题 .../Pods/Charts/Source/Charts/Charts/BarLineChartViewBase.swift:75:76: Cannot use instance member '_viewPortHandler' within property initia

我是swift新手,我正在尝试使用pod添加图表-

pod 'Charts', :git=> 'https://github.com/danielgindi/Charts.git'
在添加图表后,我发现了以下问题

.../Pods/Charts/Source/Charts/Charts/BarLineChartViewBase.swift:75:76: Cannot use instance member '_viewPortHandler' within property initializer; property initializers run before 'self' is available
.../Pods/Charts/Source/Charts/Charts/BarLineChartViewBase.swift:79:77: Cannot use instance member '_viewPortHandler' within property initializer; property initializers run before 'self' is available
.../Pods/Charts/Source/Charts/Charts/BarLineChartViewBase.swift:86:72: Cannot use instance member '_viewPortHandler' within property initializer; property initializers run before 'self' is available
.../Pods/Charts/Source/Charts/Components/AxisBase.swift:137:24: 'count' is unavailable: there is no universally good answer, see the documentation comment for discussion

我使用的是swift 3和Xcode 8.3

如果您使用的是swift 3和Xcode 8.3,您必须安装旧版本的图表。各种版本可在菜单栏的“版本”下找到:

我相信此版本应该正确安装:

如果您使用的是Swift 3、Xcode 8.3,则必须安装旧版本的图表。各种版本可在菜单栏的“版本”下找到:

我相信此版本应该正确安装:

当前版本的图表似乎支持Swift 4.1。您需要一个支持Swift 3.1的版本,这就是Xcode 8的版本

根据版本历史记录,图表3.0.2支持Swift 3.1,因此您应该安装该版本:

pod 'Charts', '3.0.2'
然后进行
pod安装


显然,您也可以选择更新到Xcode 9和Swift 4。

当前版本的图表似乎支持Swift 4.1。您需要一个支持Swift 3.1的版本,这就是Xcode 8的版本

根据版本历史记录,图表3.0.2支持Swift 3.1,因此您应该安装该版本:

pod 'Charts', '3.0.2'
然后进行
pod安装


显然,您也可以选择更新到Xcode 9和Swift 4。

我已经将platfom设置为ios 9.0,在发现这一点之前,我正在使用pod“图表”,我有点困惑。我是否需要Xcode 9.3/Swift 4.1,如这里所述,我将更新我的答案。问题出在你的Xcode/Swift版本上。我已经将platfom设置为ios 9.0,在发现这个问题之前我正在使用pod“图表”,我有点困惑。我是否需要Xcode 9.3/Swift 4.1,如这里所述,我将更新我的答案。问题出在您的Xcode/Swift版本。3.0.3在这种情况下不起作用。他在XCode 8.3上,不是9@MartinMuldoon哎呀!这是一个打字错误。。。我在代码块上方写了一行3.0.2。现在修好了。谢谢,@Sweeper的回答。我理解这个问题,但pod“图表”“~>3.0.2”不起作用。当我尝试更新或安装pod时,它仍在使用3.0.5。@Sweeper我接受答案,因为它解决了问题。你能看看我现在面临的一个新问题吗?3.0.3在这种情况下不起作用。他在XCode 8.3上,不是9@MartinMuldoon哎呀!这是一个打字错误。。。我在代码块上方写了一行3.0.2。现在修好了。谢谢,@Sweeper的回答。我理解这个问题,但pod“图表”“~>3.0.2”不起作用。当我尝试更新或安装pod时,它仍在使用3.0.5。@Sweeper我接受答案,因为它解决了问题。你能看看我现在面临的一个新问题吗-