Search code examples
swift4betaspotlightios12

INInteraction donation duplicated in Spotlight IOS 12 Beta 5


I am donating an INInteraction and everything is working ok, however I can't understand why the donation is showing up duplicated in Spotlight. Is there a property that needs to be set in order to prevent this??

    let viewUsageIntent = UsageIntent()

    var susbcribers = [INObject]()

    for sub in account.subscribers {
        let inObject = INObject(identifier: sub.phoneNumber, display: sub.id)
        susbcribers.append(inObject)
    }

    viewUsageIntent.suggestedInvocationPhrase = phrase
    viewUsageIntent.ban = account.ban
    viewUsageIntent.subs = susbcribers

    let interaction = INInteraction(intent: viewUsageIntent, response: nil)
    interaction.donate(completion: {
        error in
        if let err = error {
            MyAppServices.Logger.error(tag: "UsageIntentDonation", message: "Donation for ban \(account.ban) could not be completed: \(err.localizedDescription)")
        }
    })

Anybody dealing with this issue?. Thanks.


Solution

  • This is not a bug. This is the default behaviour when you set your simulator or iPhone to display recent shortcuts in the developer section. I was just confused by it.

    Is not a duplication, it is just displaying the newest one over older ones for development sake

    Developer Section

    Display Recent Shortcuts