0
我有問題使用#在電話中,在控制檯顯示(tel://*155*222222*123%23)
,我相信問題是使用#。我查了一下,有人說不允許在電話中使用特殊字符。swift 3使用特殊字符的電話#
var code = String()
var ID = String()
var Card = String()
@IBAction func ChargePhone(_ sender: Any) {
ID = "123"
ID = ID.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)
Card = "222222"
code = "*155*"
var RESULT = "\(code)\(Card)*\(ID)#"
RESULT = RESULT.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed)!
if let url = URL(string: "tel://\(RESULT)"), UIApplication.shared.canOpenURL(url) {
if #available(iOS 10, *) {
UIApplication.shared.open(url)
} else {
UIApplication.shared.openURL(url)
}
}