objective c - iOS central writing is not permitted -


i ios developer. can take value arduino sensor. cannot send message using following method.

[peripheral writevalue:datatowrite forcharacteristic:characteristic type:cbcharacteristicwritewithresponse]; 

"datatowrite" value alloc using nsstring*

nsstring* data = @"1"; nsdata* datatowrite = [data datausingencoding:nsutf8stringencoding]; 

and following code full code of "discovercharacteristics in service"

//discover char -(void)peripheral:(cbperipheral *)peripheral diddiscovercharacteristicsforservice:(cbservice *)service error:(nserror *)error {     if (error) {nslog(@"discover_char - error");return;}      nsstring* data = @"1";     nsdata* datatowrite = [data datausingencoding:nsutf8stringencoding];      (cbcharacteristic * characteristic in service.characteristics) {         nslog(@"discover_char - characteristic : %@",characteristic);         [peripheral writevalue:datatowrite forcharacteristic:characteristic type:cbcharacteristicwritewithresponse];     } } 

in point, want summarize question. question "even used [peripheral writevalue:forcharacteristic:type] method. why error message shown in log monitor? " "writing not permitted."

do need permission writing message arduino? or have change following code? or have problem in arduino(acutally, arduino can message other device... so, arduino source code fine. maybe...)

nsstring* data = @"1"; nsdata* datatowrite = [data datausingencoding:nsutf8stringencoding]; 

i'm bit of bluetooth noob. it's obvious i've overlooked appreciated.

thank you!:)

thank lot!!!!!!! paulw11. finally, sent data iphone arduino. checked properties of characteristic <cbcharacteristic: 0x13564a680, uuid = ffe1, properties = 0x16, value = (null), notifying = no>. characteristic's properties = 0x16. can not find 0x16 in enum of properties. still, don't know 0x16 meaning. said "values representing possible properties of characteristic. since characteristic properties can combined, characteristic may have multiple property values set." url: interpret characteristic properties (ios , ble) . anyway find solution paulw11 help! how can it? here way of solution. @ first, method [peripheral writevalue:datatowrite forcharacteristic:characteristic *type:cbcharacteristicwritewithresponse]*;. problem code type field. had understand type. type has meaning of write, read , on. so, changed type cbcharacteristicwritewithresponse cbcharacteristicpropertywrite. did. [peripheral writevalue:datatowrite forcharacteristic:characteristic *type:cbcharacteristicpropertywrite*]; thank again! paulw11


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -