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. css3 resize box-sizing outline-offset

    resize:设置用户可以自己调整大小 box-sizing: box-sizing属性可以为三个值之一:content-box(default),border-box,padding-box. co ...

  2. Codeforces Round #368 (Div. 2) A

    Description Small, but very brave, mouse Brain was not accepted to summer school of young villains. ...

  3. java提高篇---HashSet

    对于HashSet而言,它是基于HashMap来实现的,底层采用HashMap来保存元素.所以如果对HashMap比较熟悉,那么HashSet是so  easy!! 一.定义 public class ...

  4. php 日期时间操作-可算出几天后的时间

    本文为大家介绍一下根据PHP时间戳获取当前时期的具体方式.strtotime能将任何英文文本的日期时间描述解析为Unix时间戳,我们结合mktime()或date()格式化日期时间获取指定的时间戳,实 ...

  5. mvcAPI (入门 2)

    1)建立一个实体类 using System; using System.Collections.Generic; using System.Linq; using System.Web; names ...

  6. OpenLayers学习记录(1)

    1.部署自己的服务器 首先下载openlayers的源码.解压后里面有很多内容.我们只需要拷贝目录下的OpenLayer.js.根目录下的lib目录.根目录下的img目录 theme目录 到你网站的o ...

  7. STM32 NVIC

    在stm32中是要配置nvic的.何为nvic,对于我这样的初学者来说,直观感受就是在设置为中断后 还需要配置 中断的优先级nvic就是搞这个的. 那么具体的需要配置些什么那? void NVIC_C ...

  8. centos系统下设置固定IP+dns

    笔者用的linux系统是centos版本的,在次之前linux是空白,今天我在物理机用XSHELL连接虚拟机中的centos时候出现连接失败的情况,我的第一反应就是IP是不是变了?打开虚拟机之后在终端 ...

  9. uafxcwd.lib(afxmem.obj) : error LNK2005 解决方法

    项目为非MFC,但要用到MFC的库,使用过程中遇到的问题总结一下 uafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl opera ...

  10. C#实现ActiveX控件开发与部署

    现在,我们手里已经有了这个控件包:QRCode.cab,下面我们编写一个测试的网页 <html> <head> <title>无标题页</title> ...