美文网首页
[CoreBluetooth] XPC connection i

[CoreBluetooth] XPC connection i

作者: cy尘缘 | 来源:发表于2017-09-19 14:44 被阅读1442次

    CBCentralManager *centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil options:nil];

    _centralManager = centralManager;

    这里有一个注意点,CBCentralManager 的创建是异步的,如果初始化完成之后没有被当前创建它的类所持有,就会在下一次 RunLoop 迭代的时候释放。当然 CBCentralManager 实例如果不是在 ViewController 中创建的,那么持有 CBCentralManager 的这个类在初始化之后也必须被 ViewController 持有,否则控制台会有如下的错误输出:

    [CoreBluetooth] XPC connection invalid

    按照我自己的理解来说就是,如果_centralManager是局部变量,就会出现[CoreBluetooth] XPC connection invalid这样的错误提示。

    如果在xocde真机调试中只是按下方停止按钮,并没有在手机上结束任务进程,然后又按run继续运行,那么很容易就出现[CoreBluetooth] XPC connection invalid这样的提示

    注:这些都是开发时查找到的资料和自己的一些总结,如果看到到相关资料或者继续有其他的总结,也会继续更新。

    相关文章

      网友评论

          本文标题:[CoreBluetooth] XPC connection i

          本文链接:https://www.haomeiwen.com/subject/nxiirxtx.html