Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AndyDentFree opened this issue Sep 28, 2019 · 7 comments

Comments

@AndyDentFree
Copy link
Owner

AndyDentFree commented Sep 28, 2019

Trying to build with XCode 11.0 gets an error:

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

in the apps:

  • webFromIM
  • imPhoto
@AndyDentFree AndyDentFree changed the title XCode-11 XCode-11 'open(_:options:completionHandler:)' is unavailable in application extensions Sep 28, 2019
@AndyDentFree
Copy link
Owner Author

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

@AndyDentFree
Copy link
Owner Author

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
Copy link
Owner Author

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
Copy link
Owner Author

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

@AndyDentFree
Copy link
Owner Author

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
Copy link

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
Copy link
Owner Author

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())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants