我正在获取与我的应用相关的voiceShortcurts。下面的功能两次进入完成块。首先返回true,然后返回false,这是正确的。为什么它两次进入完成区?
public static func updateVoiceShortcuts(completion: @escaping ((_ haveShortcutAlready: Bool) -> Void)) {
INVoiceShortcutCenter.shared.getAllVoiceShortcuts { (voiceShortcutsFromCenter, error) in
if let voiceShortcutsFromCenter = voiceShortcutsFromCenter {
self.voiceShortcuts = voiceShortcutsFromCenter
completion(true)
} else {
if let error = error as NSError? {
print(error)
}
completion(false)
}
}
}