我正在尝试使用iOS Charts
开发一个使用条形图的应用程序。我只是设置了cocoapods
文件,导入了Charts.framework
并编译了项目,我收到了以下错误:
/Users/i3t/Desktop/AppAdmin/eCardFidAdmin/Pods/Charts/Source/Charts/Utils/ChartPlatform.swift:111:30:方法不会覆盖其超类中的任何方法
此功能发生此错误:
public final override func touchesCancelled(touches: Set<NSUITouch>, withEvent event: NSUIEvent?)
{
self.nsuiTouchesCancelled(touches, withEvent: event)
}
我删除了覆盖语句,我收到了这个新错误:
/Users/i3t/Desktop/AppAdmin/eCardFidAdmin/Pods/Charts/Source/Charts/Utils/ChartPlatform.swift:111:21:方法'touchesCancelled(:withEvent :)'与Objective-C选择器' touchesCancelled:withEvent:'与方法冲突'来自超类'UIResponder'的touchesCancelled(:withEvent :)'与相同的Objective-C选择器
有人知道如何解决这个问题?
答案 0 :(得分:0)
您没有正确地对其进行子类化 使用
import Charts
您的课必须从ChartPlatform
创建子类如果你是子类,你只能覆盖否则它不会工作
答案 1 :(得分:0)
我有同样的问题,我修改了它更改参数touches:作为一个可选的像它的父函数。 (swift 2.2)
public final override func touchesCancelled(touches: Set<NSUITouch>?, withEvent event: NSUIEvent?)
{
self.nsuiTouchesCancelled(touches, withEvent: event)
}