ios CoreBluetooth 警告 is being dealloc'ed while pending connection

CoreBluetooth[WARNING] <CBPeripheral: 0x1780a53a0 identifier = 3F8E69BD-BE87-215F-3ADD-64AE670BD750, Name = "Alert Notifictaion", state = connecting> is being dealloc'ed while pending connection

使用cb,去链接外部蓝牙设备时出现的警告;

解决方式一:

创建一个 strong 或 retain 的

@property (strong,nonatomic) CBPeripheral *connectingPeripheral;

在扫描到设备的代理里面

self.connectingPeripheral = peripheral;

存储设备;

解决方式二:

创建一个可变的数组用来保存发布的设备

discoverPeripherals = [[NSMutableArray alloc]init];

在扫描到设备的代理里面

//[discoverPeripherals addObject:peripheral];

//扫描到设备会进入方法
-(void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI{ NSLog(@"11当扫描到设备:%@",peripheral.name);
//[discoverPeripherals addObject:peripheral];
self.connectingPeripheral = peripheral;
[central connectPeripheral:peripheral options:nil];
}

  

参考:http://stackoverflow.com/questions/15846663/ios6-cbperipheral-is-being-dealloced-while-connecting

ios CoreBluetooth 警告 is being dealloc'ed while pending connection的更多相关文章

  1. iOS 去除警告 看我就够了

    你是不是看着开发过程中出现的一堆的警告会心情一阵烦躁,别烦躁了,看完此文章,消除警告的小尾巴. 一.SVN 操作导致的警告 1.svn删除文件后报错 ”xx“is missing from worki ...

  2. iOS 在 ARC 环境下 dealloc 的使用、理解误区

    iOS 在 ARC 环境下 dealloc 的使用.理解误区 太阳火神的漂亮人生 (http://blog.csdn.net/opengl_es) 本文遵循"署名-非商业用途-保持一致&qu ...

  3. ios deprecated 警告消除 强迫症的选择

    #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" ...

  4. IOS开发之内存管理--dealloc该写些什么

    在非ARC开发环境中,dealloc是类释放前,清理内存的最后机会.到底那些变量和属性该释放呢,一些特殊的类(nstimer,observer)该怎么释放.需要注意的是不释放会引起内存泄露,过度释放也 ...

  5. iOS CoreBluetooth 教程

    去App Store搜索并下载“LightBlue”这个App,对调试你的app和理解Core Bluetooth会很有帮助. ================================ Cor ...

  6. IOS开发 警告 All interface orientations must be supported unless the app requires full screen.

    在IOS开发中遇到警告  All interface orientations must be supported unless the app requires full screen. 只要勾上R ...

  7. IOS内存警告处理

    IPhone下每个app可用的内存是被限制的,如果一个app使用的内存超过20M,则系统会向该app发送Memory Warning消息.收到此消息后,app必须正确处理,否则可能出错或者出现内存泄露 ...

  8. iOS 取消警告

    第一步找到要取消的警告类型 在相应的警告上右击->Reveal in Log 被选中的-Wdeprecated-declarations就是我们所要的警告类型了. -W是前缀,这个前缀表示的是 ...

  9. iOS - 解决警告“ld: Warning: Directory Not Found for Option”

    有时候我们可能从项目中删除了某个目录.文件以后,编译出现警告信息: ld: warning: directory not found for option“XXXXXX” 具体类似下图: 很奇怪,为什 ...

随机推荐

  1. tarjan算法模板

    终于能自己完整的打下来 #include<cstdio> #include<cstring> #include<iostream> #include<vect ...

  2. 多态,虚拟方法,重写,接口,类库,委托,is,as运算符,泛型集合,万能变量

    多态:简而言之就是龙生九子,各有不同 有了继承,才有了多态 1.虚方法 virtual重写 override父类中的方法,在子类中并不适用,那么子类需要自主更改继承的方法或者是属性,那父类中加了vir ...

  3. nn

    <li> <a href="#" class="dropdown-toggle"> <i class="icon-des ...

  4. 双4G LTE

    我们即将上市的Xplay3S将支持双4G LTE(TDD-LTE+FDD-LTE),那什么是4G LTE呢,今天来给大家科普下4G LTE网络知识. 什么是TDD-LTE/FDD-LTE? LTE是通 ...

  5. extern "C" __declspec(dllexport) __declspec(dllimport) 和 def

    原文:extern "C" __declspec(dllexport) __declspec(dllimport) 和 def 前面的extern "C"  _ ...

  6. CPU的一些参数和排名

    排名的信息来源: http://itianti.sinaapp.com/index.php/cpu 一些参数的信息来源: http://ark.intel.com/ 个人关注一些的一些CPU排名: I ...

  7. missing sdkl in .NET Core 1.0.1 - VS 2015 Tooling Preview 2

    打开项目的时候,提示缺少sdk 在C:\Program Files\dotnet\sdk找不到对应的版本 解决方法: https://github.com/aspnet/Tooling/blob/ma ...

  8. Perform Cut Copy Paste Operations Using Cut_Region Copy_Region Paste_Region Commands In Oracle Forms

    You can do Select, Cut, Copy and Paste operations on text items in Oracle Forms using Select_All, Cu ...

  9. jquery的$.与$.fn的区别

    这个是jquery插件的形式,举个例子: <div id="myDiv"></div> (function($){ $.fn.extend({ test:f ...

  10. 屏幕序列Screen Sequences

    声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...