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. acdream Divide Sum

    Divide Sum Time Limit: 2000/1000MS (Java/Others)Memory Limit: 128000/64000KB (Java/Others) SubmitSta ...

  2. linq的简单查询 和 组合查询

    以Car表和Brand表为例,其中Car表的Brand是Brand表的Brandcode. (1)建立两表的linq(一定要做好主外键关系,),创建之后不用修改,如要添加,另建文件. (2)Car表的 ...

  3. SqlSever基础 union 将得到的横表变为纵表

    镇场诗:---大梦谁觉,水月中建博客.百千磨难,才知世事无常.---今持佛语,技术无量愿学.愿尽所学,铸一良心博客.------------------------------------------ ...

  4. 【leetcode❤python】 438. Find All Anagrams in a String

    class Solution(object):    def findAnagrams(self, s, p):        """        :type s: s ...

  5. UVA 10564 十 Paths through the Hourglass

     Paths through the Hourglass Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & % ...

  6. (转)C# Winform应用程序占用内存较大解决方法整理

    背景: 微软的 .NET FRAMEWORK 现在可谓如火如荼了.但是,.NET 一直所为人诟病的就是“胃口太大”,狂吃内存,虽然微软声称 GC 的功能和智能化都很高,但是内存的回收问题,一直存在困扰 ...

  7. SQL查看表锁定,死锁解锁

    select request_session_id spid,OBJECT_NAME(resource_associated_entity_id) tableName from sys.dm_tran ...

  8. application 网站计数器

    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...

  9. Photoshop CS6 快捷键

    1.工具箱   移动工具 [V]矩形.椭圆选框工具 [M]套索.多边形套索.磁性套索 [L]快速选择工具.魔棒工具 [W] 裁剪.透视裁剪.切片.切片选择工具 [C]吸管.颜色取样器.标尺.注释.12 ...

  10. 随机步法A-Z

    程序是生成一个10X10的字符数组,初始化时全为 ‘.’  的随机步法.程序必须随机的从一个元素 ‘走到’ 另一个元素,每次只向上.向下.向左或向右移动一个元素位置.已访问过的元素按访问顺序用字母A到 ...