2016-10-07 1 views
0

私はiOS Chartsを使って棒グラフを使用するアプリケーションを開発しようとしています。私は、cocoapodsファイルを設定Charts.frameworkをインポートし、プロジェクトをコンパイルし、私は次のエラーを得た:のiOSチャートコンパイルエラー

/Users/i3t/Desktop/AppAdmin/eCardFidAdmin/Pods/Charts/Source/Charts/Utils/ChartPlatform.swift:111:30: Method does not override any method from its superclass

このエラーは、この関数で起こっている:

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: Method 'touchesCancelled(:withEvent:)' with Objective-C selector 'touchesCancelled:withEvent:' conflicts with method 'touchesCancelled(:withEvent:)' from superclass 'UIResponder' with the same Objective-C selector

誰かがそれをどのように修正できますか?

+0

3署名がイベントに 'に変更したスイフトである: ''代わりwithEvent事象の: ' – dan

+0

はまだ動作しません。それは奇妙ですが、他の機能に問題はありません。関数 "touchesCancelled" –

答えて

0

あなたは

import Charts 

適切 使用し、それをサブクラス化されていませんあなたのクラスは、あなただけがそうでなければサブクラス化されている場合、それは私が持っている

+0

こんにちは、お返事ありがとうございます。しかし、私は理解していません。あなたが「あなたのクラス」と言うとき、あなたはどんな授業を話していますか?私が言ったように、私は自分のコードで何も変更せず、ただChart.frameworkをインポートしました。あなたはもっと説明できますか? –

0

を働く習慣上書きすることができChartPlatform

からサブクラス化する必要があります同じ問題を解決し、パラメータの変更を修正しました:親関数のようにオプションです。この仮定(SWIFT 2.2)

public final override func touchesCancelled(touches: Set<NSUITouch>?, withEvent event: NSUIEvent?) 
    { 
     self.nsuiTouchesCancelled(touches, withEvent: event) 
    }