I'm working on an App that takes a photo and adds a filter to it through the shortcuts app. Works fine in the simulator, but when I run on my iPad and iPhone I receive this message:
I attempted to change the size of the image to see if that would speed things up, but I'm left with the same results.
My intents handler:
import Foundation
import Intents
import SwiftUI
class DrawingIntentHandler: NSObject, GenerateDrawingIntentHandling{
func handle(intent: GenerateDrawingIntent, completion: @escaping (GenerateDrawingIntentResponse) -> Void) {
let response = GenerateDrawingIntentResponse(code: .success, userActivity: nil)
guard let param = intent.images else {return}
guard let filename = param.fileURL else { return }
guard let fileimage = UIImage(contentsOfFile: filename.path) else { return }
guard let cartoon = Cartoonify(image: fileimage).result else {return}
guard let pngData = cartoon.pngData() else { return }
response.drawing = INFile(data: pngData, filename: param.filename, typeIdentifier: "public.png")
completion(response)
}
func confirm(intent: GenerateDrawingIntent, completion: @escaping (GenerateDrawingIntentResponse) -> Void) {
completion(GenerateDrawingIntentResponse(code: .ready, userActivity: nil))
}
}