私は迅速に ResearchKit チュートリアル ( http://www.raywenderlich.com/104575/researchkit-tutorial-with-swift ) に従っていますが、どちらの IBaction メソッドもメイン ストーリーボードのボタンに接続できません。コードは次のとおりです(チュートリアルから):
import ResearchKit
class ViewController: UIViewController {
@IBAction func consentTapped(sender : AnyObject) {
let taskViewController = ORKTaskViewController(task: ConsentTask, taskRunUUID: nil)
taskViewController.delegate = self
presentViewController(taskViewController, animated: true, completion: nil)
}
@IBAction func surveyTapped(sender : AnyObject) {
let taskViewController = ORKTaskViewController(task: SurveyTask, taskRunUUID: nil)
taskViewController.delegate = self
presentViewController(taskViewController, animated: true, completion: nil)
}
}
extension ViewController : ORKTaskViewControllerDelegate {
func taskViewController(taskViewController: ORKTaskViewController, didFinishWithReason reason: ORKTaskViewControllerFinishReason, error: NSError?) {
taskViewController.dismissViewControllerAnimated(true, completion: nil)
}
}
メイン ストーリーボードに移動して View Controller をクリックし、クラスを ViewController と UIViewController の両方に設定しようとしましたが、メソッドは送信済みイベントに表示されるはずですが、表示されません。ctrl ドラッグも試しましたが、うまくいきませんでした。