码迷,mamicode.com
首页 > 系统相关 > 详细

Characteristics with cached values must be read-only

时间:2014-11-11 18:03:12      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:io   ar   sp   for   strong   数据   on   bs   ad   

在用CoreBluetooth 做蓝牙数据传输时,把设备设为周边设备报此错误:

Characteristics with cached values must be read-only

 

经查询是因为在构造 Characteristic 时设置了 Value,根据官方说明,当Value 不是nil 时,只能设置为只读状态。

 

Note: If you specify a value for the characteristic, the value is cached and its properties and permissions are set to be readable. Therefore, if you need the value of a characteristic to be writeable, or if you expect the value to change during the lifetime of the published service to which the characteristic belongs, you must specify the value to be nil. Following this approach ensures that the value is treated dynamically and requested by the peripheral manager whenever the peripheral manager receives a read or write request from a connected central

Characteristics with cached values must be read-only

标签:io   ar   sp   for   strong   数据   on   bs   ad   

原文地址:http://www.cnblogs.com/1oo1/p/4089697.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!