Instance Method

connectPeripheral:options:

Establishes a local connection to a peripheral.

Declaration

- (void)connectPeripheral:(CBPeripheral *)peripheral options:(NSDictionary<NSString *,id> *)options;

Parameters

peripheral

The peripheral to which the central is attempting to connect.

options

A dictionary to customize the behavior of the connection. For available options, see Peripheral Connection Options.

Discussion

If a local connection to a peripheral is successfully established, the central manager object calls the centralManager:didConnectPeripheral: method of its delegate object. If the connection attempt fails, the central manager object calls the centralManager:didFailToConnectPeripheral:error: method of its delegate object instead. Attempts to connect to a peripheral do not time out. To explicitly cancel a pending connection to a peripheral, call the cancelPeripheralConnection: method. The cancelPeripheralConnection: method is implicitly called when peripheral is deallocated.

See Also

Establishing or Canceling Connections with Peripherals

cancelPeripheralConnection:

Cancels an active or pending local connection to a peripheral.