1

プロジェクトでCore Bluetoothを使用しており、すべて正常に動作しますが、デバイスの Bluetooth が無効になっていると、テキストLE_POWER_OFF_HEADERと「設定」および「キャンセル」ボタンを含むアラートが表示されます。テキストと言語を変更したいと思います。

これはデフォルトのアラートのようで、変更できません。

アラートは、中央の状態が のときにポップアップ表示されpoweredOffます。この関数を使用して、Central Manager の状態を確認します。

- (void)centralManagerDidUpdateState:(CBCentralManager *)central{ 
NSString *messtoshow;

switch (central.state) {
    case CBCentralManagerStateUnknown:
    {
        messtoshow=[NSString stringWithFormat:@"State unknown, update imminent."];
        break;
    }
    case CBCentralManagerStateResetting:
    {
        messtoshow=[NSString stringWithFormat:@"The connection with the system service was momentarily lost, update imminent."];
        break;
         }
    case CBCentralManagerStateUnsupported:
         {
        messtoshow=[NSString stringWithFormat:@"The platform doesn't support Bluetooth Low Energy"];
        break;
         }
    case CBCentralManagerStateUnauthorized:
         {
        messtoshow=[NSString stringWithFormat:@"The app is not authorized to use Bluetooth Low Energy"];
        break;
         }
    case CBCentralManagerStatePoweredOff:
         {
        messtoshow=[NSString stringWithFormat:@"Bluetooth is currently powered off."];
        break;
         }
    case CBCentralManagerStatePoweredOn:
         {
        messtoshow=[NSString stringWithFormat:@"Bluetooth is currently powered on and available to use."];
        [mgr scanForPeripheralsWithServices:[NSArray arrayWithObject:[CBUUID UUIDWithString:@"180D"]] options:nil];
        [mgr retrieveConnectedPeripherals];

        //--- it works, I Do get in this area!

        break;
    }   

}
NSLog(messtoshow); }
4

1 に答える 1