我有一个项目要添加sirikit。我添加了这个意图,并想将值存储在我的领域的数据存储中,当我尝试访问用于创建此任务的函数时,我得到了错误提示。这是我的下面的代码
extension IntentHandler : INCreateTaskListIntentHandling {
public func handle(intent: INCreateTaskListIntent,
completion: @escaping (INCreateTaskListIntentResponse) -> Swift.Void) {
guard let title = intent.title else {
completion(INCreateTaskListIntentResponse(code: .failure, userActivity: nil))
return
}
CategoryFunctions.instance.createList(name: title.spokenPhrase,.....)
var tasks: [INTask] = []
if let taskTitles = intent.taskTitles {
let taskTitlesStrings = taskTitles.map {
taskTitle -> String in
return taskTitle.spokenPhrase
}
tasks = createTasks(fromTitles: taskTitlesStrings)
CategoryFunctions.instance.add(tasks: taskTitlesStrings, toList: title.spokenPhrase)
}
let response = INCreateTaskListIntentResponse(code: .success, userActivity: nil)
response.createdTaskList = INTaskList(title: title,
tasks: tasks,
groupName: nil,
createdDateComponents: nil,
modifiedDateComponents: nil,
identifier: nil)
completion(response)
}
}
此singlton实例在我的应用程序中很好地工作,但我不知道为什么我收到一个错误提示Use of unresolved identifier 'CategoryFunctions'
我的CategoryFunctions单例
class CategoryFunctions {
let appDelegate = UIApplication.shared.delegate as! AppDelegate
var database:Realm!
static let instance = CategoryFunctions()
.....
...
答案 0 :(得分:0)
在xcode中选择文件,在右侧,选择“文件检查器”,然后在“目标成员身份”下,选择您的Intent。