iOS 8.0 bluetooth peripheral manager giving no callback for addService

I am adding the service using:

[self.peripheralManager addService:myService];

Is this method deprecated in iOS8.0 or this error might be due to some other reasons?

Most likely some other reason, but we need more code. There is change between ios7 and ios8 in that ios7 permitted operations before the Bluetooth hardware was initialised (power on state) and issued a warning. In ios8 it just fails. Show the code for peripheralManagerDidUpdateState: and how you call addService–  Paulw11 Sep 24 ‘14 at 6:47

@Paulw has answered this correctly in the comments. Below is the answer

There is change between ios7 and ios8 in that ios7 permitted operations before the Bluetooth hardware was initialised (power on state) and issued a warning. In ios8 it just fails.

So we must wait for the peripheralManagerDidUpdateState: callback before adding any service.

http://stackoverflow.com/questions/26008296/ios-8-0-bluetooth-peripheral-manager-giving-no-callback-for-addservice

时间: 2024-09-30 07:37:46

iOS 8.0 bluetooth peripheral manager giving no callback for addService的相关文章

iOS开发 - Core Bluetooth蓝牙开发

Core Bluetooth Core Bluetooth测试比较麻烦,正常情况下,得至少有2台真实的蓝牙4.0设备 如何让iOS模拟器也能测试蓝牙4.0程序? 买一个CSR蓝牙4.0 USB适配器,插在Mac上 在终端输入sudo nvram bluetoothHostControllerSwitchBehavior="never" 重启Mac 用Xcode 4.6调试代码,将程序跑在iOS 6.1的模拟器上 (苹果把iOS 7.0模拟器对BLE的支持移除掉了) Core Bluet

IOS BLE4.0蓝牙和外设连接和收发数据的流程

前言: 苹果在IOS 6系统之后开始支持BLE 4.0,iPhone4s,iPod 5,iPad 3等之后的机型开始内嵌BLE4.0硬件,因此在开发前请先确认你的开发环境符合上述要求,并且苹果在BLE4.0之后,对外部的连接设备已经不在需要MFI认证了,当然你的外设肯定得要有蓝牙4.0模块了 综述: 开发BLE4.0的App,你需要在你的项目里面导入框架: CoreBluetooth.framework 在需要使用到蓝牙的文件里面你需要导入头文件: #import <CoreBluetooth/

关于iOS10 Xcode8真机测试项目出现的问题 &quot;code signing is required for product type &#39;xxxxx&#39; in SDK &#39;iOS 10.0&quot;..

昨天用真机测试项目出现这样的错误,在网上搜集了一些信息,所以将自己的经验分享出来帮助更多的人. 第一步: 检查你的1和2是否填写正确,如果你是运行别人的项目,BundleIdentifier要和你的Xcode之前填写的要一致,例如,我之前填写的com.baidu.xxxx,但是我真机测试的是com.alibaba.xxx,这样就不一致了,可能会导致错误 第二步: 在Bulid Setting 中找到Singning, 在3处,你可能会看到自己的开发者账号,不要选!!,还有下面 4 Develop

视频播放 iOS8.0 与iOS 9.0

#import "ViewController.h" #import <AVFoundation/AVFoundation.h> #import <AVKit/AVKit.h> #import <MediaPlayer/MediaPlayer.h> @interface ViewController () @property(nonatomic ,strong)MPMoviePlayerController * PlayerController; @

iOS 9.3 到 iOS 10.0 的开发API不同点

iOS 9.3 to iOS 10.0 API Differences Objective-C /usr/include Accelerate AudioToolbox AudioUnit AVFoundation AVKit CallKit (Added) CFNetwork CloudKit Contacts CoreBluetooth CoreData CoreFoundation CoreGraphics CoreImage CoreLocation CoreMedia CoreMoti

&#39;sizeWithFont:constrainedToSize:&#39; is deprecated: first deprecated in iOS 7.0 - Use -boundingRectWithSize:options:attributes:context:

解决方法: NSString *myText = @"xxxxx"; 将 CGSize mySize =[myText sizeWithFont:myFont constrainedToSize:CGSizeMake(200,100)]; 改写成: CGSize mySize = [myText boundingRectWithSize:CGSizeMake(200,100) options:NSStringDrawingUsesLineFragmentOrigin attribute

embedded dylibs/frameworks are only supported on iOS 8.0 and later 错误解决

ld: warning: embedded dylibs/frameworks only run on iOS 8 or later ld: embedded dylibs/frameworks are only supported on iOS 8.0 and later (@rpath/XXX.framework/XXX) for architecture armv7 clang: error: linker command failed with exit code 1 (use -v t

iOS 8.0正式公布啦

从昨晚開始,苹果新版移动操作系统iOS 8.0開始提供免费下载服务.新版操作系统提供有数百个新功能,当中包含相机功能中添加了延时摄影模式,能够使用其它厂商开发的输入法.购买的App应用程序能够与最多6位家人共享而不用再花钱购买. 苹果提示iOS 8.0的文件包大小为900多MB,可是在实际安装时,须要占用将近5GB的存储空间,存储空间不够的朋友们可能须要删除一些音乐或视频大文件.

IOS UIAlertController 弹框 (ios 9.0 后代替了UIAlertView弹框 和 UIActionSheet下弹框)

在IOS 9.0 后 苹果官方宣布不再或不推荐使用UIAlertView 和 UIActionSheet 由UIAlertController进行代替两者 用控制器将两者合二为一 很简单 方便 下面就是关于UIAlertView的常用方法 #import "RootViewController.h" @interface RootViewController () @end @implementation RootViewController - (void)viewDidLoad {