2

我正在开发一个在 Xcode 上使用 ResearchKit 和 Swift 的应用程序。ResearchKit 软件相对简单,但视图控制器中的这段特定代码有以下信息:

“使用未声明的类型”

对于所有三种ORKTaskViewControllerXXX类型,我不知道如何解决它。这是我的代码:

import UIKit

class ViewController: UIViewController {
    @IBAction func consentTapped(sender : AnyObject) {
        let ORKTaskViewController = taskViewController(task: consentTapped, taskRunUUID: nil)
        taskViewController.delegate = self
        presentViewController(taskViewController, animated: true, completion: nil)
    }
}

extension ViewController : ORKTaskViewControllerDelegate {
    func taskViewController(taskViewController: ORKTaskViewController, didFinishWithReason reason: ORKTaskViewControllerFinishReason, error: NSError?) {
        //Handle results with taskViewController.result
        taskViewController.dismissViewControllerAnimated(true, completion: nil)
    }
}
4

1 回答 1

1

尝试import ResearchKit在视图控制器中添加您正在调用的ResearchKit相关内容。

import UIKit
import ResearchKit
于 2018-06-06T16:37:06.167 回答