CoreBluetooth API MISUSE - Issues with CBCentralManager in iOS 13 features like Siri Shortcuts

余生长醉 提交于 2019-12-02 10:27:26

I found that making the hook to my view model static solved the issue.

I guess siri shortcuts does not like to create CBCentralManger more than once. I find this strange however, because this logic works fine in the context of an ordinary iOS widget with a TodayViewController

public class MyIntentHandler : MyIntentHandling
{
  static AppExtensionViewModel viewModel; //I needed to make this static 
  AppExtensionViewModel ViewModel
  {
    get
    {
      if (this.viewModel == null)
      {
        this.viewModel = new AppExtensionViewModel();
      }
      return this.viewModel;
  }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!