iPhone5(iOS7.0.2)私の環境はBLEタグです。BLEタグにデータを送信したい。だから私はこの方法を使用します:
- (void) peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error
{
for(CBCharacteristic *c in [service characteristics])
{
if([service isEqual:immediateAlertService] &&
[[c UUID] isEqual:ProximityTag.alertLevelCharacteristicUUID])//"2A06"
{
immediateAlertAlertLevelCharacteristic = c;
}
}
...
[self.peripheral writeValue:[NSData dataWithBytes:&level length:1] forCharacteristic:immediateAlertAlertLevelCharacteristic type:CBCharacteristicWriteWithoutResponse];
レベルは0x70。ただし、writeValue メソッドが動作しない場合があります。
iPhone ==> data ==> tag (X)
tag ==> data ==> iPhone(O)
これ以上何を見ることができますか?CBService? CBCharacteristic?