Unable to find Bluetooth Device (iOS)

App development related product technical discussions, including OEM App, App SDK, device control interface development, mini program development and other topics.


Post Reply
lilia
Posts: 11

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.

Attachments
Logs
Logs
Archive.zip
Screen records
(19.1 MiB) Downloaded 69 times
huangdaxia
Posts: 4

Re: Unable to find Bluetooth Device (iOS)

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.

lilia
Posts: 11

Re: Unable to find Bluetooth Device (iOS)

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>

lilia
Posts: 11

Re: Unable to find Bluetooth Device (iOS)

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>
Don Arias
Posts: 2

Re: Unable to find Bluetooth Device (iOS)

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") } } }
huangdaxia
Posts: 4

Re: Unable to find Bluetooth Device (iOS)

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.

Don Arias
Posts: 2

Re: Unable to find Bluetooth Device (iOS)

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.

lilia
Posts: 11

Re: Unable to find Bluetooth Device (iOS)

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.

Post Reply