デリゲートを取得したらdidConnectPeripheral:(CBPeripheral *)peripheral
、retrievePeripherals とそれに続くdidRetrievePeripherals
. 実行可能でリスクがなければ、より簡単に思えます。
どのくらい(CBPeripheral *)peripheral
で再利用できますか?その周辺機器との切断後も有効ですか?
ワークフロー:
scanForPeripheralsWithServices()
- 周辺機器をスキャンするdidDiscoverPeripheral:(CBPeripheral *)peripheral
- 検出されたときconnectPeripheral:peripheral
didConnectPeripheral:(CBPeripheral *)peripheral
stopScan を保存して(CBPeripheral *)peripheral
、後で使用できるようにします。- ... 読み取りまたは書き込みの特性 ...
cancelPeripheralConnection
didDisconnectPeripheral
後で再接続するには...
connectPeripheral:peripheral
- ペリフェラルを含むアレイからdidConnectPeripheral:(CBPeripheral *)peripheral
...