INIntent Issue

INIntent Issue

In my main app, after I send a message(key code):

let inImage = INImage(imageData: imageData)
let person = INPerson(
    personHandle: INPersonHandle(
    value: personId,
    type: .emailAddress),
    nameComponents: nil,
    displayName: personName,
    image: inImage,
    contactIdentifier: nil,
    customIdentifier: String(chatid)
)
let smi = INSendMessageIntent(
    recipients: persons,
    outgoingMessageType: .outgoingMessageText,
    content: nil,
    speakableGroupName: groupName,
    conversationIdentifier: "\(chatid)",
    serviceName: nil,
    sender: nil,
    attachments: nil
)
smi.setImage(inImage, forParameterNamed: \.speakableGroupName)
let interaction = INInteraction(intent: smi, response: nil)
interaction.groupIdentifier = String(chatid)
interaction.donate { error in }

I get INImage instance in share extension by:

if let intent = extensionContext?.intent as? INSendMessageIntent,
   let avatar = intent.keyImage() 
{
    // ...
}

When I call INImage.fetchUIImage method:

func loadImageBy(_ inImage: INImage) {
    imgView.image = nil
    loadImageIdentifier = UUID()
    inImage.fetchUIImage { [weak self, loadImageIdentifier] image in
        guard self?.loadImageIdentifier == loadImageIdentifier else { return }
        self?.imgView.image = image
    }
}

I got this error:

Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[INRemoteImageProxy fetchUIImageWithCompletion:]: unrecognized selector sent to instance 0x2810969e0’
INIntent Issue
 
 
Q