HomeiOS Developmentswift - Integrating CoreML mannequin into an iOS Message Filter Extension

swift – Integrating CoreML mannequin into an iOS Message Filter Extension


I’ve an iOS Message Filter App Extension set-up and I’ve a CoreML .mlmodel file that I need to use on this extension.
The mlmodel has a Goal Membership for each the app, and the app extension.

However when I attempt to use it from the ILMessageFilterExtension class, I get the next error:

Error Area=com.apple.CoreML Code=0 "initialization of textual content classifier mannequin with mannequin information failed" UserInfo={NSLocalizedDescription=initialization of textual content classifier mannequin with mannequin information failed}

That is my code (MessageClassifier is my mannequin’s generated class title) :

do {
    let config = MLModelConfiguration()
    let mannequin = strive MessageClassifier(configuration: config)
    
    let messageClassifier = MessageClassifierInput(textual content: message)
    let prediction = strive mannequin.prediction(enter: messageClassifier)
    
    let classification = MessageClassification(stringLiteral: prediction.label)
    
    return classification.messageFilterAction
} catch {
    logger.log(degree: .os, icon: "‼️", "Message classification failure: (error)")
}

Any concept why this might occur? Could not discover something on-line or any permissions I want so as to add for this.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments