回答編集履歴
1
delegate
answer
CHANGED
@@ -2,4 +2,24 @@
|
|
2
2
|
[peripheral setNotifyValue:YES forCharacteristic:characteristic2];
|
3
3
|
```
|
4
4
|
|
5
|
-
で良いんじゃないでしょうか?
|
5
|
+
で良いんじゃないでしょうか?
|
6
|
+
|
7
|
+
【追記】
|
8
|
+
|
9
|
+
peripheral:didDiscoverCharacteristicsForService:error:デリゲートの中で、
|
10
|
+
|
11
|
+
```objectivec
|
12
|
+
- (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error
|
13
|
+
{
|
14
|
+
if ([service.UUID isEqual:[CBUUID UUIDWithString:SERVICE_UUID]])
|
15
|
+
{
|
16
|
+
[service.characteristics enumerateObjectsUsingBlock:^(CBCharacteristic *characteristic, NSUInteger idx, BOOL *stop)
|
17
|
+
{
|
18
|
+
if ([characteristic.UUID isEqual:[CBUUID UUIDWithString:CHARACTERISTIC_UUID]])
|
19
|
+
{
|
20
|
+
[peripheral setNotifyValue:YES forCharacteristic:characteristic];
|
21
|
+
}
|
22
|
+
}];
|
23
|
+
}
|
24
|
+
}
|
25
|
+
```
|