我在Xcode上使用带有Swift的ResearchKit开发应用程序。 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)
}
}
答案 0 :(得分:1)
尝试在您调用import ResearchKit
相关内容的视图控制器中添加ResearchKit
。
import UIKit
import ResearchKit