Reproduction steps
Xcode15.1
iPhone14Pro/iOS16.3
commission with MatterSupport
implementation
@objc class func commission(with setupPayload: MTRSetupPayload?) throws
{
MTRLog("MatterSupport start request")
let topology: MatterAddDeviceRequest.Topology = .init(
ecosystemName: "SmartHome",
homes: [
// .init(displayName: "smart office"),
// .init(displayName: "smart living"),
]
)
let request = MatterAddDeviceRequest(
topology: topology,
setupPayload: setupPayload
)
Task
{
do
{
try await request.perform()
} catch {
throw error
}
}
}
Always failed with
Error on commissioning step 'FindOperational': '../../../../../../../../Sources/CHIPFramework/connectedhomeip/src/credentials/CHIPCert.cpp:488: CHIP Error 0x0000004A: CA certificate not found'
relate issue: https://github.com/project-chip/connectedhomeip/issues/31309
Post
Replies
Boosts
Views
Activity
I use DataScannerViewController to scan barcode and text recognize, and then get the AVCaptureDevice to use torch on/off, but DataScannerViewController will stop scanning.
DataScannerViewController has no related API to get AVCaptureDevice to use torch.
Expected: Could use AVCaptureDevice to turn on/off torch, at the same time DataScannerViewController could scan.
Run the sample code as doc https://developer.apple.com/documentation/mattersupport?changes=latest_minor
import MatterSupport
let request = MatterAddDeviceRequest(
topology: .init(ecosystemName: "Acme SmartHome", homes: [
.init(displayName: "Default Acme Home"),
])
)
do {
try await request.perform()
print("Successfully set up a device!")
} catch {
print("Failed to set up a device with error: \(error)")
}
it runs but stuck in the scene below, never get the callback.
Another issue about MatterSupport, when integrated with objective-c the bridge file(eg xx-Swift.h) turn out to show error:
Cannot find interface declaration for 'MatterAddDeviceExtensionRequestHandler', superclass of 'MatterAddDeviceHandler'
Xcode Version 14.2 (14C18)
My code:
//
// MatterHelper.swift
// xx
//
// Created by Robin on 2023/3/21.
//
import Foundation
import MatterSupport
@available(iOS 16.1, *)
class MatterHelper: NSObject
{
@objc class func commission()
{
let request = MatterAddDeviceRequest(
topology: .init(ecosystemName: "RRRRRR", homes: [
.init(displayName: "R11111"), .init(displayName: "R222222")
])
)
Task.init
{
do
{
try await request.perform()
print("Successfully set up a device!")
}
catch
{
print("Failed to set up a device with error: \(error)")
}
}
}
}
@available(iOS 16.1, *)
class MatterAddDeviceHandler: MatterAddDeviceExtensionRequestHandler
{
override func validateDeviceCredential(_ deviceCredential: MatterAddDeviceExtensionRequestHandler.DeviceCredential) async throws
{
print("validateDeviceCredential \(deviceCredential)")
}
override func selectThreadNetwork(from threadScanResults: [MatterAddDeviceExtensionRequestHandler.ThreadScanResult]) async throws -> MatterAddDeviceExtensionRequestHandler.ThreadNetworkAssociation
{
print("selectThreadNetwork \(threadScanResults)")
return ThreadNetworkAssociation.defaultSystemNetwork
}
override func commissionDevice(in home: MatterAddDeviceRequest.Home?, onboardingPayload: String, commissioningID: UUID) async throws
{
print("Home: \(String(describing: home)) " + "payload: \(onboardingPayload) " + "commissionID: \(commissioningID)")
}
}
Many thanks for your help.
Is there a way to support matter from iOS11.0?
In the CHIP Tool iOS Sample Commissioner App readme doc says:
Requires building and running the app to a physical device on iOS >= 15.4.
Does it mean that the sample app matter framework cannot support iOS < 15.4?
I have just changed the sample project configuration mini deployment version to iOS 11.0,
built and ran, soon the app crashed
Found MatterSupport.h is still empty, use Matter.h instead?
Starting with 16.1 you need to use MatterSupport.
In Xcode 14.2 iOS16.2 Framework MatterSupport.h is empty,
should I use Matter.h instead?
iShot_2023-03-15_19 37 28
Is it possible to detect a system alert popping up? Such as low power alert.
I try to receive remote notifications in widgets(implemented through WidgetKit), but failed.
It known that enable remote notifications should register first by calling
UIApplication.shared.registerForRemoteNotifications()
but in widget cannot calling shared, it is available in widgets
@property(class, nonatomic, readonly) UIApplication *sharedApplication NS_EXTENSION_UNAVAILABLE_IOS("Use view controller based solutions where appropriate instead.");
and if try to init a UIApplication(by UIApplication()), the app will crash for more than one UIApplication instance.