watch button press crash

为君一笑 提交于 2020-01-06 06:01:09

问题


it seems to be the same error and conditions as this unanswered SO question, but I have more to add (its really easy to replicate)

Create a new project in the latest Xcode

iOS App with WatchKit App

Go to the WatchKit App > Interface.storyboard and put a single button on the Interface Controller Scene > Interface Controller

Go to WatchKit Extension > InterfaceController.swift and add a new member

@IBOutlet var scheduleMeetingButton: WKInterfaceButton!

and method

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

then go back to Interface.storyboard and link both of these to the button

launch the app (on the watch simulator)

than click the button and you will get this exec error

What is causing this error?


回答1:


From looking at your code i would suggest updating the action function from sender: any to sender: wkinterfacebutton hope this helps!



来源:https://stackoverflow.com/questions/50477499/watch-button-press-crash

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!