gpt4 book ai didi

ios - 索要号码功能错误 canOpenURL : failed for URL: "tel://0478733797" - error: "This app is not allowed to query for scheme tel"

转载 作者:行者123 更新时间:2023-11-30 11:40:08 25 4
gpt4 key购买 nike

我在日志中收到此错误?

虽然我在模拟器上运行它,但这在测试阶段会重要吗?

canOpenURL: failed for URL: "tel://0478733797" - error: "This app is not allowed to query for scheme tel" callNumber button pressed

这是我的函数。

字符串是“0478733797”

func callNumber(phoneNumber:String) {
if let phoneCallURL = URL(string: "tel://\(phoneNumber)") {
let application:UIApplication = UIApplication.shared
if (application.canOpenURL(phoneCallURL)) {
application.open(phoneCallURL, options: [:], completionHandler: nil)

}
}
}

最佳答案

您遇到的错误说明您不允许您的应用程序打开查询方案。要解决这个问题,您应该在 info.plist 中添加以下权限

<key>LSApplicationQueriesSchemes</key>
<array>
<string>tel</string>
</array>

并在设备而不是模拟器上运行您的应用程序

关于ios - 索要号码功能错误 canOpenURL : failed for URL: "tel://0478733797" - error: "This app is not allowed to query for scheme tel",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49355698/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com