【问题标题】:how to call ios functions from watch kit如何从手表套件中调用 ios 函数
【发布时间】:2019-11-07 05:09:57
【问题描述】:

我正在开发 iOS 项目,他们要求我制作与我们的 iOS 应用程序相关的 Apple Watch 应用程序 如果用户单击 Apple Watch 按钮,我需要调用 iOS 功能 然后我想从 iOS 应用程序向手表发送消息 不知道怎么弄,求大神帮忙?

【问题讨论】:

    标签: ios swift watchkit watch


    【解决方案1】:

    您应该遵循此文档,还提供了示例代码:
    Using Watch Connectivity to Communicate Between Your Apple Watch App and iPhone App

    【讨论】:

      【解决方案2】:

      使用以下函数调用电话框架。将下面的代码放在 Watch 函数中

      let contactNumber = "1234567890"
      
      if let callTelUrl = URL(string: "tel:\(contactNumber)"){
           let wkEXt = WKExtension.shared()
           wkEXt.openSystemURL(callTelUrl)                
      }
      

      快乐编码...:)

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-03-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-05-27
        • 1970-01-01
        • 1970-01-01
        • 2016-03-26
        相关资源
        最近更新 更多