I have the same issue, I can not fetch from the IntentHandler.swift so in my App I created an array of values when the appp opens and closes that saves some values to an array in the app group,
let defaults = UserDefaults.init(suiteName: "group.my-app")!
defaults.setValue(CoreDataStack.createArrayOfContactsForWidget(), forKey: "ContactsForWidgetIntent")
static func createArrayOfContactsForWidget() - [String] {
var arrayOfContactIDsAndNames = [String] ()
let fetchRequest = NSFetchRequestUser()
let entity = User.entity()
fetchRequest.entity = entity
fetchRequest.predicate = NSPredicate(format: "isVisible = %@", "1")
do {
var users = try CoreDataStack.managedObjectContext!.fetch(fetchRequest)
users.sort(by: { $0.first_name $1.first_name })
for user in users {
//To get an array of currently added users
arrayOfContactIDsAndNames.append("\(user.contactID)|\(Helper.getUserFullName(user: user))")
}
} catch {print(error)}
return arrayOfContactIDsAndNames
}
Then in the intent I pull that contact ID and the name to display and it works fine on iPhone but not on Mac.
...
contactIDsArray = defaults.value(forKey: "ContactsForWidgetIntent") as! [String]
for user in contactIDsArray {
let values = user.components(separatedBy: "|")
let contactID = values[0]
let name = values[1]
let personIntentObject = Person(identifier: "\(contactID)", display: "\(name)")
userItems.append(personIntentObject)
}
completion(INObjectCollection(items: userItems), nil)
Not sure why but its working on iPhone. On Mac I get an error that there are No options provided for this parameter