AndyDentFree / im-plausibilities

Explorations of apps for Apple's iMessage
MIT License
6 stars 0 forks source link

XCode-11 'open(_:options:completionHandler:)' is unavailable in application extensions #2

Open AndyDentFree opened 5 years ago

AndyDentFree commented 5 years ago

Trying to build with XCode 11.0 gets an error:

'open(_:options:completionHandler:)' is unavailable in application extensions for iOS

in the apps:

AndyDentFree commented 5 years ago

Asked a question on Stack Overflow. For now, personally, going back to XCode 10

AndyDentFree commented 4 years ago

Have updated imDataUrlApp in 0363e39 to prove that self.extensionContext?.open still works to open a parent app, but there's no solution for opening Settings or external web links

AndyDentFree commented 4 years ago

Whilst I've yet to update these samples with this, Touchgram has been updated to prove you can do work around this as a two-step thing, which was recommended by Apple DTS.

  1. Forward the URL to your parent app using self.extensionContext?.open
  2. Have the parent app then launch the external app or URL on your behalf.
AndyDentFree commented 4 years ago

Was fixed in 585e2ea by using a local webView and forwarding URLs to a host app to open them (official DTS recommendation).

AndyDentFree commented 2 years ago

Re-opened because the fix above was only applied to webFromIM sample and imPhoto was left unbuildable, with its code in onUseCamera trying to open the settings dialog

ThirupathiRaoM commented 1 year ago

Hello, Hope you are doing great; I am also Working on message extension part I did Everything it working Fine as well But in my Message conatins the url also But When I tapped the Message Not opening anything Any suggestion for me I am attacking my Code below

private func share_UrlMethod(tag:Int){ let layout = MSMessageTemplateLayout() if let account_info = myAccounts?[tag]{ layout.caption = account_info.first_name ?? "" let finalurl = "https://b-intouch.me/staging/public/uploads/user_images/" + (account_info.user_img ?? "").replacingOccurrences(of: " ", with: "%20") if let url = URL(string: finalurl), let imageData = try? Data(contentsOf: url), let uiImage = UIImage(data: imageData) { layout.image = uiImage } else { layout.image = UIImage(named: "") } // layout.mediaFileURL = URL(string: account_info.account_Url ?? "")

    }
    //"Here is my B in Touch digital business card:"
    var components = URLComponents()
    let rating1 = URLQueryItem(name: "rating1", value: myAccounts?[tag].account_Url ?? "")
    components.queryItems = [rating1]
   // layout.subcaption = myAccounts?[tag].account_Url ?? ""
    let message = MSMessage()
    message.url = components.url!
    message.layout = layout
    self.activeConversation?.insert(message, completionHandler: { [weak self] (error) in
        guard self != nil else {return}
        DispatchQueue.main.async {
            if (error == nil) {
                debugPrint("Message sent")
            } else {
                debugPrint("Error!")
            }
        }
    })
}
AndyDentFree commented 1 year ago

Please move this to a StackOverflow question and have a close look at imUrlData

It differs in the MSMessage:

        let session = conversation.selectedMessage?.session
        let message = MSMessage(session: session ?? MSSession())