WatchKit app “Unlock to activate”

本小妞迷上赌 提交于 2019-12-06 04:38:04

I found the correct answer at the Apple Developer Forum:

Q: If you would like to debug willActivate/didDeactivate in a specific Interface Controller in your WatchKit app or Glance, once it is showing in the iOS Simulator, you can choose Hardware > Lock from the iOS Simulator menu bar to trigger didDeactivate. Repeat to unlock and trigger willActivate.

I found this in beta4, but some confusion. Is it just a test function in simulator? The app on real watch would not be locked after iphone locked, right?

A: Correct, it's just for testing.

Q: Is there a way to test the watch app in the simulator while the phone is locked? It seems like this would be an important test case as well, but right now the watch only shows "unlock to activate" while the phone is locked.

A: Not currently.

Link: (but you mast have a developer account) https://devforums.apple.com/message/1106203#1106203

Josh Gafni

Did you try something like this: Easy way to update app content via apple watch

Does calling openParentApplication not work when the iphone is locked?

When it comes to getting the iPhone to perform things in the background, openParentApplication works very well. Essentially, openParentApplication will run while your phone is locked.

This link: http://www.bignerdranch.com/blog/watchKit-extensions-communicating-with-your-parent-application/

has one of the best and easiest to understand tutorials I've found. Really helped me out, hope that helps.

You should be able to grab your data using openParentApplication

Good luck

vomako

Active background mode to ensure that the parent app has time to send its reply. For a code example on how to use the background mode, refer to Calling parent application from Watch app.

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