Page 1 of 1

Unable to find Bluetooth Device (iOS)

Posted: 2024年 Jan 11日 07:41
by lilia

Hi! I'm developing an app using SDK to control Ambiance Light device. I've run an example https://github.com/tuya/tuya-home-ios-sdk-sample-objc and wasn't able to find my device through Bluetooth. While with Smart Life app I can find, connect and control it.

All permissions for app are granted.

Thank you for any help!

My env:
iPhone 13 Pro
iOS 17.1.2
Xcode 15.2

I'm adding zip file with screen records from both sdk example app and Smart Life app, also adding logs.


Re: Unable to find Bluetooth Device (iOS)

Posted: 2024年 Jan 11日 20:05
by huangdaxia

From the attachment, it appears that you are using Single-Point Bluetooth scanning, and your Smart Ambient Light is a BLE& WIFI device, so it cannot be scanned. You can use 'Dual Mode' to scan the device.


Re: Unable to find Bluetooth Device (iOS)

Posted: 2024年 Jan 11日 21:45
by lilia

It has absolutely the same result for Dual Mode scanning.

And why did you suggest that this device is Dual Mode? This product registered as Bluetooth device (just wondering, because maybe I'm missing something)

Device Type - Common Device
Protocol - Bluetooth
Data Protocol - Tuya Standard Protocol

Also, just saw this warning, maybe it can be connected too?

Code: Select all

API MISUSE: <CBCentralManager: 0x2801e4a00> has no restore identifier but the delegate implements the centralManager:willRestoreState: method. Restoring will not be supported

And noticed

Code: Select all

Bluetooth Background Permission is not enabled in the current application

But all required permissions according to documentation are there (and Capabilities Access Wi-Fi Information is added)

<key>NSBluetoothAlwaysUsageDescription</key>
<string>For Bluetooth scan</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>For Bluetooth scan</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>For Bluetooth scan</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>For Bluetooth scan</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>For Bluetooth scan</string>


Re: Unable to find Bluetooth Device (iOS)

Posted: 2024年 Jan 11日 22:33
by lilia

Ok, so I added another permission (which wasn't mentioned in any documentation) and it fixed warnings mentioned above, but it still can't find the device and doesn't trigger didDiscoveryDeviceWithDeviceInfo

Code: Select all

<key>UIBackgroundModes</key>
<array>
	<string>bluetooth-central</string>
</array>

Re: Unable to find Bluetooth Device (iOS)

Posted: 2024年 Jan 24日 00:17
by Don Arias

Good evening, I'm having the same problem. I followed all the configuration steps. Have you found a solution? How to do the dual mode scan?

I'm using SwiftUI.

Xcode version: 15.2

Here's a portion of my code that scans

Code: Select all

func startListening() {
        
print("Trying to") ThingSmartBLEManager.sharedInstance().startListening(true) func didDiscoveryDevice(withDeviceInfo deviceInfo: ThingBLEAdvModel) { print("seach\(deviceInfo)") ThingSmartBLEManager.sharedInstance().activeBLE(deviceInfo, homeId: self.homeId) { model in print("Trying to active the single BLE device \(deviceInfo)") self.isSuccess = true } failure: { print("Failed to Activate BLE Device") } } }

Re: Unable to find Bluetooth Device (iOS)

Posted: 2024年 Jan 24日 18:21
by huangdaxia

Tuya supports a variety of Bluetooth product device, such as Single BLE (only one Bluetooth module), BLE + Wi-Fi dual model, BLE Beacon, and Bluetooth Mesh.We design products that are independent of each other and do not interfere with each other. Therefore, the methods called by scanning the device are different. It is recommended to verify which Bluetooth product it is as follows.

  1. You can try to scan all Bluetooth device types in the sdk demo to see which cell item will appear.

  2. Use tuya app to configure the device and provide the device ID.


Re: Unable to find Bluetooth Device (iOS)

Posted: 2024年 Jan 24日 23:27
by Don Arias

I would like to point out that I have successfully integrated with the Android mobile SDK. Now we're working on the iOS application with the iOS SDK.


Re: Unable to find Bluetooth Device (iOS)

Posted: 2024年 Jan 26日 04:29
by lilia

As it turned out in my case, I was provided with wrong information and device is Bluetooth Mesh as I figured out by myself.
But when I was trying different connection methods from the demo app, I wasn't able to test SIG Mesh scan as there wasn't implemented createSIGMeshWithHomeId method, so I added it and then was able to find the device.