How to open message app but not with send messages view in ios swift

740 Views Asked by At

I am opening the app by using this code

    UIApplication.shared.open(URL(string: "sms:")!, options: [:], completionHandler: nil)

but I only want to open message app not with send message controller can I do it in ios swift

video attached: https://www.sendspace.com/file/j1yijj

2

There are 2 best solutions below

2
CentrumGuy On

From what I can tell, this isn't possible since the only way to open native iOS apps is through the URL schemes provided by Apple. As far as I'm aware, "sms" is the only URL scheme that opens the Messages app and it always shows the compose message prompt regardless of whether a phone number is provided or not :(

0
Brian Sachetta On

I was able to get the following to do what you're asking:

if let url = URL(string: "messages://"), UIApplication.shared.canOpenURL(url) {
    UIApplication.shared.open(url)
}

Full disclosure: I have only tested this on iOS 14, and I have not tried submitting it to the App Store to see if Apple approves it or not.