【发布时间】:2018-11-16 10:14:45
【问题描述】:
我正在开发一个在 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)
}
}
【问题讨论】:
标签: ios swift researchkit