Swift 已经添加了LSApplicationQueriesScheme,但仍然出现错误:“No No No msserror.dll;此应用程序不允许查询方案whatsapp“;

Swift 已经添加了LSApplicationQueriesScheme,但仍然出现错误:“No No No msserror.dll;此应用程序不允许查询方案whatsapp“;,swift,share,nsurl,uiapplication,Swift,Share,Nsurl,Uiapplication,我已经检查了关于这个问题的其他几个问题,并为whatsapp安装了LSApplicationQueriesScheme,但我的应用程序仍然不允许与whatsapp共享 这是我的Info.plist文件的屏幕截图: 这是我的共享whatsapp代码。我很想得到一些帮助。我已经检查了其他堆栈溢出问题,它们没有帮助 @IBAction func shareWhattsappButtonTapped(_ sender: UIButton) { let shareMessage = "Hola

我已经检查了关于这个问题的其他几个问题,并为whatsapp安装了
LSApplicationQueriesScheme
,但我的应用程序仍然不允许与whatsapp共享

这是我的
Info.plist
文件的屏幕截图:

这是我的共享whatsapp代码。我很想得到一些帮助。我已经检查了其他堆栈溢出问题,它们没有帮助

@IBAction func shareWhattsappButtonTapped(_ sender: UIButton) {

    let shareMessage = "Hola! Estoy buscando a mi \(posts!.petType) que es de raza \(posts!.breed). La ultima vez que lo vimos fue en \(posts?.address). Ayudenme a encontrarlo porfavor! Subi la foto con toda la información a Gastet. Pueden verlo aquí: https://itunes.apple.com/mx/app/gastet/id1407059324?l=en&mt=8"

    shareWhatssapp(message: shareMessage)
}

func shareWhatssapp(message: String) {

    let msg = message
    let urlWhats = "whatsapp://send?text=\(msg)"
    if  let urlString = urlWhats.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) {
        if let whatsappURL = NSURL(string: urlString) {
            if  UIApplication.shared.canOpenURL(whatsappURL as URL ) {
                UIApplication.shared.open(whatsappURL as URL)
            }
        }
    }
}

我就是这样设法解决whatssapp问题的:

在我的info.plist中,这是它的外观:

info.plist中的输入错误 在Info.plist中,您忘记了“LSApplicationQueriesSchemes”末尾的“s”

错: LSApplicationQueriesScheme

对的:
LSApplicationQueriesScheme

是,而不是
LSApplicationQueriesScheme
。(这并不重要,但您最好在Swift中使用
URL
而不是
NSURL
。)是的!这工作做得很好!谢谢……你能在这里提出你的解决方案吗@AvaEamer@CongFandi我是去年做的,所以我不确定这是否是我当时所做的全部,但我发布了我从我的项目中发现的东西。祝你好运!希望对你有用我就是这样做的@joel
func shareWhatssapp(message: String) {
    
    let msg = message
    let urlWhats = "whatsapp://send?text=\(msg)"
    if  let urlString = urlWhats.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) {
        if let whatsappURL = NSURL(string: urlString) {
            if  UIApplication.shared.canOpenURL(whatsappURL as URL ) {
                UIApplication.shared.open(whatsappURL as URL)
            }
        }
    }
}