The completion of allowMessageSendForSession() has changed recently. Pass an Error in the completion, see updated Apple docu at https://developer.apple.com/documentation/mailkit/mecomposesessionhandler/3824908-allowmessagesendforsession
The docu contains a code snippet:
enum ComposeSessionError: LocalizedError {
case invalidRecipientDomain
var errorDescription: String? {
switch self {
case .invalidRecipientDomain:
return "example.com is not a valid recipient domain"
}
}
}
func allowMessageSendForSession(_ session: MEComposeSession, completion: @escaping (Error?) -> Void) {
// Confirm none of the recipients use @example.com.
if session.mailMessage.allRecipientAddresses.contains(where: { $0.hasSuffix("@example.com")}) {
completion(ComposeSessionError.invalidRecipientDomain)
} else {
completion(nil)
}
}
Topic:
App & System Services
SubTopic:
General
Tags: