【问题标题】:watch button press crash手表按钮按下崩溃
【发布时间】:2018-05-23 10:42:00
【问题描述】:

它似乎与this unanswered SO question 的错误和条件相同,但我还有更多要添加(它真的很容易复制)

在最新的Xcode中新建项目

带有 WatchKit 应用的 iOS 应用

转到 WatchKit App > Interface.storyboard 并在 Interface Controller Scene > Interface Controller 上放置一个按钮

转到 WatchKit Extension > InterfaceController.swift 并添加一个新成员

@IBOutlet var scheduleMeetingButton: WKInterfaceButton!

和方法

@IBAction func scheduleMeeting(_ sender: Any) { }

然后返回 Interface.storyboard 并将这两个链接到按钮

启动应用程序(在手表模拟器上)

比点击按钮,你会得到这个执行错误

是什么导致了这个错误?

【问题讨论】:

    标签: swift watchkit


    【解决方案1】:

    通过查看您的代码,我建议将操作函数从 sender: any 更新为 sender: wkinterfacebutton 希望这会有所帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多