iOS 藍牙4.0(BLE)後臺或者鎖屏也可以接收數據的方法

iOS 藍牙4.0(BLE)後臺或者鎖屏也可以接收數據的方法


其實就是配置一下工程的info.plist文件

如圖:


建一個名字爲  Required background modes數組 , 加入兩個字符串。

App shares data using CoreBluetooth  和  App communicates using CoreBluetooth


然後.....沒有然後了....OK了


  1. - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification*)notification  
  2. { //處理接收到藍牙數據的代理方法 
  3.      
  4.    //去掉icon圖標的數字的方法  也是現實icon紅色小圓圈裏的數字的方法
  5.     application.applicationIconBadgeNumber -= 1;  
  6. }  

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章