There was a similar problem.
This worked in Swift 2, but was included in Swift 3 (I am bouncing off two of our apps similar to Facebook and Facebook Messenger):
var userId: Int!
var userType: String!
// userId and userType are set by some code somewhere else...
if let url = URL(string: "anotherappicreated://?userId=\(userId)&userType=\(userType)") {
UIApplication.shared.openURL(url) // Open our other app
}
Swift 2 (, !) . Swift 3 :
var userId: Int!
var userType: String!
if let userId = userId,
let userType = userType,
let url = URL(string: "anotherappicreated://?userId=\(userId)&userType=\(userType)") {
UIApplication.shared.openURL(url)
}