IOS - Can't open Whatsapp chat programatically, but can do it through HTML

前端 未结 2 1962
感情败类
感情败类 2021-01-14 17:45

I have a Web page with an anchor that has href=\"whatsapp:+(xxxxxxxxx)\", if i click on it on my iPhone (iOS 9), it opens WhatsApp in the chat view for that contact (i can s

2条回答
  •  时光说笑
    2021-01-14 18:17

    You should add the WhatsApp URL scheme to your application Info.plist

    LSApplicationQueriesSchemes
    
        whatsapp
    
    

    According to Apple Developer documentation

    IMPORTANT If your app is linked on or after iOS 9.0, you must declare the URL schemes you want to pass to this method. Do this by using the LSApplicationQueriesSchemes array in your Xcode project’s Info.plist file. For each URL scheme you want your app to use with this method, add it as a string in this array.

    If your (iOS 9.0 or later) app calls this method using a scheme you have not declared, the method returns NO, whether or not an appropriate app for the scheme is installed on the device.

提交回复
热议问题