ShoutSocial / share_handler

A plugin to facilitate receiving and handling share intents
43 stars 45 forks source link

SwiftShareHandlerIosPlatform.swift deprecated in iOS 14.0 #76

Closed gekosurf closed 11 months ago

gekosurf commented 1 year ago

ios/Classes/SwiftShareHandlerIosPlatform.swift

SwiftShareHandlerIosPlatform.swift:246:41 'init(recipients:content:speakableGroupName:conversationIdentifier:serviceName:sender:)' was deprecated in iOS 14.0: Use the designated initializer with outgoingMessageType instead

https://developer.apple.com/documentation/sirikit/insendmessageintent/3552231-init

following code:

func recordSentMessage(_ media: SharedMedia?, error: AutoreleasingUnsafeMutablePointer<FlutterError?>) {
    // Create an INSendMessageIntent to donate an intent for a conversation with Juan Chavez.
    if let media = media {
        if #available(iOS 11.0, *) {
            let groupName = INSpeakableString(spokenPhrase: media.speakableGroupName ?? "Unknown Contact")
            let sendMessageIntent = INSendMessageIntent(recipients: nil,
                                                        content: nil,
                                                        speakableGroupName: groupName,
                                                        conversationIdentifier: media.conversationIdentifier,
                                                        serviceName: media.serviceName,
                                                        sender: nil)

should be ...

func recordSentMessage(_ media: SharedMedia?, error: AutoreleasingUnsafeMutablePointer<FlutterError?>) {
    // Create an INSendMessageIntent to donate an intent for a conversation with Juan Chavez.
    if let media = media {
        if #available(iOS 11.0, *) {
            let groupName = INSpeakableString(spokenPhrase: media.speakableGroupName ?? "Unknown Contact")
            let sendMessageIntent = INSendMessageIntent(recipients: nil,
                                                        content: nil,
                                                        speakableGroupName: groupName,
                                                        conversationIdentifier: media.conversationIdentifier,
                                                        serviceName: media.serviceName,
                                                        sender: nil,
                                                        attachments: nil,)
JoshJuncker commented 11 months ago

This should be fixed in 0.0.20, with share_handler_ios version 0.0.12.