【问题标题】:Swift error "Use of undeclared type" in ViewControllerViewController 中的 Swift 错误“使用未声明的类型”
【发布时间】: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


    【解决方案1】:

    尝试在视图控制器中添加import ResearchKit,你正在调用ResearchKit相关的东西。

    import UIKit
    import ResearchKit
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-10-28
    • 1970-01-01
    • 2015-10-28
    • 2018-05-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多