简体   繁体   English

SendMessage并发症控制器唤醒iOS应用

[英]SendMessage Complication Controller Wake iOS App

So, I am trying to use the oppertunity when my Watchkit complication calls requestUpdateDidBegin () to use sendMessage () to wake my iOS app and cause it to calculate complication data and use transferCurrentComplicationUserInfo () to update the complication. 因此,当我的Watchkit并发症调用requestUpdateDidBegin ()使用sendMessage ()唤醒我的iOS应用并使其计算并发症数据并使用transferCurrentComplicationUserInfo ()来更新并发症时,我尝试使用这种机会。 I call sendMessage () from the extension delegate. 我从扩展委托调用sendMessage ()。 I am experiencing mixed luck with this actually reaching the iOS app. 我遇到了运气与实际到达iOS应用程序。 Even with my iPhone next to the watch the performance varies. 即使将iPhone放在手表旁,性能也会有所不同。 One time I built my app to my phone and it successfully delivered over 30 updates to my complication through sendMessage () and transferCurrentComplicationUserInfo (), over the course of two days. 有一次,我在手机上构建了应用程序,并在两天内通过sendMessage ()和transferCurrentComplicationUserInfo ()成功地为并发症提供了30多个更新。 I then uninstalled the app from the watch using the watch app, and then reinstalled it from the watch app (So absolutly no code or build changes) and it stopped working! 然后,我使用watch应用程序从手表中卸载了该应用程序,然后从watch应用程序中重新安装了该应用程序(因此绝对没有代码或构建更改),并且它停止了工作! I suspect there is clearly some bugs and unreliability with calling sendMessage (). 我怀疑调用sendMessage ()显然存在一些错误和不可靠性。 Is anyone else finding this, is there any workarounds? 是否有其他人找到这个,是否有解决方法? How can I wake my iPhone app from when the complication controller calls requestUpdateDidBegin ()? 当并发症控制器调用requestUpdateDidBegin ()时,如何唤醒iPhone应用程序?

I don't believe there is any guarantee you can wake the iPhone from the watch. 我认为无法保证可以将iPhone从手表中唤醒。 If you need to update with data from the phone, you are better to schedule the updates on the iPhone app and then push the updated data from the phone. 如果需要使用手机中的数据进行更新,最好在iPhone应用程序上安排更新,然后从手机中推送更新的数据。 You'll probably need to enable a background mode on the iPhone app for this to work (location services, background data transfer, depending on your data type.) 您可能需要在iPhone应用程序上启用后台模式才能正常工作(定位服务,后台数据传输,具体取决于您的数据类型。)

(As posted here https://forums.developer.apple.com/thread/26934 ) (如发布在这里https://forums.developer.apple.com/thread/26934

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM