1, I add an Matter extension named TRMatterExtension, using the Template in Xcode.
2, check the InfoPlist with the TRMatterExtension module, I see the NSExtension key with two key which are like this:
3,The RequestHandler.swift file is like this:
import os
import MatterSupport
let logger = Logger(subsystem: "com.airdroitech.commissionMtr2", category: "MatterExtension")
// The extension is launched in response to MatterAddDeviceRequest.perform() and this class is the entry point
// for the extension operations.
class RequestHandler: MatterAddDeviceExtensionRequestHandler {
override init() {
logger.log("QAWI3 - init")
super.init()
}
override func validateDeviceCredential(_ deviceCredential: MatterAddDeviceExtensionRequestHandler.DeviceCredential) async throws {
// Use this function to perform additional attestation checks if that is useful for your ecosystem.
logger.log("QAWI3 - validateDeviceCredential")
}
override func selectWiFiNetwork(from wifiScanResults: [MatterAddDeviceExtensionRequestHandler.WiFiScanResult]) async throws -> MatterAddDeviceExtensionRequestHandler.WiFiNetworkAssociation {
// Use this function to select a Wi-Fi network for the device if your ecosystem has special requirements.
// Or, return `.defaultSystemNetwork` to use the iOS device's current network.
logger.log("QAWI3 - Returning default system network")
return .defaultSystemNetwork
}
override func selectThreadNetwork(from threadScanResults: [MatterAddDeviceExtensionRequestHandler.ThreadScanResult]) async throws -> MatterAddDeviceExtensionRequestHandler.ThreadNetworkAssociation {
// Use this function to select a Thread network for the device if your ecosystem has special requirements.
// Or, return `.defaultSystemNetwork` to use the default Thread network.
return .defaultSystemNetwork
}
override func commissionDevice(in home: MatterAddDeviceRequest.Home?, onboardingPayload: String, commissioningID: UUID) async throws {
// Use this function to commission the device with your Matter stack.
logger.log("QAWI3 - Starting commissioning flow")
}
override func rooms(in home: MatterAddDeviceRequest.Home?) async -> [MatterAddDeviceRequest.Room] {
// Use this function to return the rooms your ecosystem manages.
// If your ecosystem manages multiple homes, ensure you are returning rooms that belong to the provided home.
return [.init(displayName: "Living Room")]
}
override func configureDevice(named name: String, in room: MatterAddDeviceRequest.Room?) async {
// Use this function to configure the (now) commissioned device with the given name and room.
}
}
4, I add Privacy - Local Network Usage Description and Bonjour services [
_matter._tcp
_matterc._udp
_matterd._udp
] to the main target's InfoPlist.
5, click a button to call MatterAddDeviceRequest.perform(), the code is as the following:
let homes = [MatterAddDeviceRequest.Home(displayName: "TRHome")]
let topology = MatterAddDeviceRequest.Topology(ecosystemName: "TR", homes: homes)
let request = MatterAddDeviceRequest(topology: topology)
do {
try await request.perform()
print("Successfully set up device!")
} catch {
print("Failed to set up device with error: (error)")
}
6, Result:
Most times, Matter devices can be added to the KeyChain and the commission window of the Matter device could be opened. But sometimes the MatterSupport window will show "Pairing Failed". The total error is: [1E1D8753] Failed to perform Matter device setup setup: Error Domain=HMErrorDomain Code=18 "Pairing Failed" UserInfo={HFErrorUserInfoOptionsKey={
HFErrorUserInfoOptionDescriptionKey = "Pairing Failed";
HFErrorUserInfoOptionTitleKey = "\U65e0\U6cd5\U6dfb\U52a0\U914d\U4ef6";
}, NSLocalizedDescription=Pairing Failed, NSUnderlyingError=0x3009e8240 {Error Domain=HAPErrorDomain Code=15 "Failed to pair Matter Accessory in time" UserInfo={NSLocalizedDescription=Failed to pair Matter Accessory in time, NSUnderlyingError=0x3009e86c0 {Error Domain=HAPErrorDomain Code=24 "(null)"}}}}.
From the log I can see, the Function selectWiFiNetwork(from wifiScanResults: [MatterAddDeviceExtensionRequestHandler.WiFiScanResult]) async throws -> MatterAddDeviceExtensionRequestHandler.WiFiNetworkAssociation of the RequestHandler.swift file will be called and commissionDevice(in home: MatterAddDeviceRequest.Home?, onboardingPayload: String, commissioningID: UUID) will NOT called. Sometimes the RequestHandler class will not be called at all, this means the first function validateDeviceCredential will not be called. But ,when this happens, the iPhone will Continuously can NOT add device for a long time, sometimes it gets better inexplicably. Even under normal circumstances, the probability of successfully adding a device is less than 50% and very slowly. When using Apple Home app, the success rate is very high, almost 100%, and very fast.
So, can you help me identify where the problem is and what areas need attention? Thank you very much!
Finally, I often encounter logs like this:
nw_browser_dns_service_browse_callback [B3] not in ready or waiting state
Do you know what it means and whether it will affect the equipment distribution network? My testing machine is iPhone 12, operating on iOS 18 and above 17.0.
Thank you very much!
General
RSS for tagExplore the art and science of app design. Discuss user interface (UI) design principles, user experience (UX) best practices, and share design resources and inspiration.
Post
Replies
Boosts
Views
Activity
Hello, I'm developing an iOS app in Flutter, but I'm having trouble enabling Background Mode.
I added the following configuration to Info.plist and Runner.entitlements:
<key>UIBackgroundModes</key>
<array>
<string>processing</string>
<string>fetch</string>
<string>location</string>
</array>
However, the Background Mode option doesn't appear in my App ID to be enabled.
And the build fails with the message: Provisioning profile "Ready Response ios_app_store ..."
doesn't include the UIBackgroundModes entitlement.
How can I enable this option in my App ID?
Note: I'm using Android Studio and publishing through Codemagic.
I am working on a MapView with MapAnnotation on the Map and am having difficulty getting the MapAnnotation to function properly when selected. In my code, I want the MapAnnotation selected to be to the front if it is behind or partially blocked by another annotation. I have tried using a zIndex but this does not appear to work. Below is my MapView code along with a screenshot of the issue. Any help would be greatly appreciated.
struct HospitalMapView: View {
@StateObject var viewModel = HospitalViewModel()
@State private var showSearchView = false
@State private var showListView = false
@State private var selectedTab: Int = 0
var body: some View {
ZStack {
VStack(spacing: 0) {
TopTabView()
// Map that updates the visible hospitals when the user moves or adjusts the map
Map(coordinateRegion: $viewModel.region, interactionModes: .all, annotationItems: viewModel.filteredHospitals) { hospital in
MapAnnotation(coordinate: CLLocationCoordinate2D(latitude: hospital.latitude, longitude: hospital.longitude)) {
RoundedRectangle(cornerRadius: 40)
.fill(viewModel.colorForPercentile(viewModel.calculatePercentile(for: hospital, in: viewModel.filteredHospitals)))
.frame(width: 70, height: 30) // Maintain consistent size, adjust if necessary
.overlay(
Text("$\(Int(hospital.baseCharge / 1000))K")
.foregroundColor(.white)
.bold()
)
.overlay(
RoundedRectangle(cornerRadius: 40)
.stroke(Color.blue, lineWidth: viewModel.selectedHospital == hospital ? 3 : 0)
)
.onTapGesture {
viewModel.selectHospital(hospital)
// Move the selected hospital to the end of the list to bring it to the front
viewModel.bringHospitalToFront(hospital)
viewModel.showBottomSheet = true
}
.scaleEffect(viewModel.selectedHospital == hospital ? 1.1 : 1.0) // Highlight the selected hospital
.zIndex(viewModel.selectedHospital == hospital ? 1 : 0) // Set the zIndex higher for the selected hospital
.animation(.easeInOut, value: viewModel.selectedHospital) // Smooth transition
}
}
.onAppear {
// Initial update of visible hospitals when the map appears
viewModel.updateFilteredHospitals()
}
.onChange(of: viewModel.region) { _ in
// Update the visible hospitals as the user changes the map region
viewModel.updateFilteredHospitals()
}
.edgesIgnoringSafeArea(.all)
}
// Hospital count display hovering over the map
Text("\(viewModel.filteredHospitals.count) Hospitals")
.font(.subheadline)
.foregroundColor(.white)
.padding(8)
.background(Color.black.opacity(0.6))
.cornerRadius(10)
.padding(.top, -315) // Adjust padding to position correctly below the TopTabView
.zIndex(1) // Ensure it's above the map
if let selectedHospital = viewModel.selectedHospital, viewModel.showBottomSheet {
BottomSheetView(isOpen: $viewModel.showBottomSheet, maxHeight: UIScreen.main.bounds.height * 0.3) {
SummaryTabView(selectedHospital: Binding(
get: { selectedHospital },
set: { newValue in viewModel.selectHospital(newValue) }
))
}
.transition(.move(edge: .bottom))
.animation(.spring())
}
}
.safeAreaInset(edge: .bottom) {
BottomTabView(selectedTab: $selectedTab, showListView: $showListView, showSearchView: $showSearchView,
onSearchSelected: {
showSearchView = true
showListView = false
}, onHomeSelected: {
showSearchView = false
showListView = false
}, onListSelected: {
showListView = true
showSearchView = false
})
}
.fullScreenCover(isPresented: $showSearchView) {
SearchView(viewModel: viewModel, showSearchView: $showSearchView, selectedTab: $selectedTab, showListView: $showListView)
}
.fullScreenCover(isPresented: $showListView) {
ListView(selectedTab: $selectedTab, showListView: $showListView, showSearchView: $showSearchView)
.environmentObject(viewModel)
}
.environmentObject(viewModel)
}
}
I have added dark, tinted and light version for my app icon, it only works on the simulator but when I run the app on a real device it doesn't work at all and only display the default light icon.
Hola, cree una app en swiftui, la version minima de ios 16.2, la desarrolle en xcode 15 sin problema, funcionaba hasta ios 17 sin inconvenientes, actualice a xcode 16 ahora que la ejecuto en ios 18 presenta problemas en varios elementos de la interfaz, por ejemplo cuando toco un boton no desencadena una acción inmediata, tengo que sostener el toque en el boton para que reaccione y asi varios elementos que necesito tocar para llamar una acción, probe la app y funciona correctamente en dispositivos con ios desde el 16.2 al 17, intente modificar el código de los elementos para mejorar el gesto de tocar, pero no funciona, no se porque pasa esto en IOS 18, alguna sugerencia para resolver esto, gracias.
I upgraded to Sequoia and now can only use one external; when I add a second one the cursor goes crazy.
Hi apple I love the new update but one thing that bothers me is that when we are customizing the app colors it only lets us do the black or white background for it and in order to do that your whole phone has to be on light or dark mode. id like to make a suggestion to let us change the background and logo on the app. thank you
Dear Apple,
I’m loving the IOS 18 update so fa; everything is awesome. However could you please takeoff the underlined feature. It’s makes text so difficult to look at and disrupts the simplistic nature of an iPhone. 🥹😭🙏
Following is a row item within a section of CPListTemplate,
CPListItem(text: "Station 1", detailText: "Details\nforStation 1")
In the above, is it possible to display data in three lines? I have seen couple of CarPlay apps that do it within a list. However, I am not sure how this can be done. Kindly suggest some ideas
Currently I have the below,
I want to achieve the below, three lines with a row
Hello, I am a UI designer.
I am trying to modify our app's icon to accommodate Apple's iOS 18 dark mode. Our app icon is quite complex in shape, making it difficult to recognize in dark mode.
Is it okay if the shape differs slightly between light mode and dark mode? Or should I just change the color?
It would be a great innovation to incorporate a Card Reader into both iPhones and Apple Watches. The user could open the card reader app on his watch or phone, enter the amount to be paid into his nominated bank account (eg £15) ready for the purchaser/customer to tap his card to make the contactless payment. It would simplify my everyday life enormously because I hardly ever carry cash these days.
Hi Apple. I got some 3-4 dots appearing on extreme left and right side of the screen of my ipad after iOS 18 beta update. I need some help
Who on Earth okayed this new photo gallery design? I can’t find anything, scrolling is not smooth, there’s a bunch of content categories I will literally never view that I can’t remove from the gallery, this is EXTREMELY frustrating. How can I revert back to iOS 17?
Hello,
Whenever I swipe down on the homepage to pull up the search bar, and go to type something in it, it’s really glitchy and buggy. Oftentimes the search bar keeps reloading and I can’t seem to type more than one letter at a time without an issue. Please look into this.
Hi, i´m trying to get a menu with three rows. The top one should be a HStack with three RoundedRectangle (Red, Yellow and Green). The second row and the third one (both separated with a Divider from the top one) are for edit and delete. But I get five rows, three empty rows plus the edit row and the delete row. The three first rows are empty but they execute the moveTask function correctly. I don't know how to solve this. Can anybody help please?
struct TaskView: View {
@EnvironmentObject var viewModel: BoardViewModel
@EnvironmentObject var languageManager: LanguageManager
@State private var isEditing = false
let task: Task
var body: some View {
HStack(alignment: .center, spacing: 8) {
Text(task.title)
.font(.system(size: 16, weight: .medium))
.foregroundColor(.primary)
.lineLimit(4)
.multilineTextAlignment(.leading)
.fixedSize(horizontal: false, vertical: true)
Spacer(minLength: 0)
Menu {
ColorButtonsView(task: task, viewModel: viewModel)
Divider()
Button(action: {
self.isEditing = true
}) {
Label(languageManager.localizedString("edit"), systemImage: "pencil")
}
Button(action: {
viewModel.deleteTask(task)
}) {
Label(languageManager.localizedString("delete"), systemImage: "trash")
}
} label: {
Image(systemName: "ellipsis")
.font(.system(size: 20))
.foregroundColor(.gray)
.frame(width: 30, height: 30)
}
}
.padding(.vertical, 8)
.padding(.horizontal, 12)
.background(Color.white)
.cornerRadius(10)
.shadow(color: Color.black.opacity(0.1), radius: 3, x: 0, y: 1)
.sheet(isPresented: $isEditing) {
EditTaskView(task: task, viewModel: viewModel)
}
}
}
struct ColorButtonsView: View {
let task: Task
let viewModel: BoardViewModel
var body: some View {
HStack(spacing: 10) {
ForEach(Column.allCases, id: \.self) { column in
Button(action: {
viewModel.moveTask(task, to: column)
}) {
RoundedRectangle(cornerRadius: 5)
.fill(colorForColumn(column))
.frame(width: 30, height: 30)
}
}
}
}
private func colorForColumn(_ column: Column) -> Color {
switch column {
case .toDo:
return .red
case .inProgress:
return .yellow
case .done:
return .green
}
}
}
Video Playback on iOS 18 public release is asinine. I use video playback to show slow-motion video frame by frame to my students and the video can only be shown at like 3/5 of the screen size (just like Apple fouled up screenshot editing about a year ago)
If you try to view video in the full screen you can’t scrub through and see time stamps or play frame by frame sliding left to right. It’s absolutely ridiculous. 2 out of 3x the video timeline finishes fully right and I haven’t watched the full clip.
Here’s a video showing the issue how at the small default size I can see the entire timeline and play the full video from beginning to end, but when I go to full screen and/or zoom in or move the screen around the timeline doesn’t work and you can’t scroll through the full video!
Need the video to not condense in size on the screen and play the full height / width of the screen. Also not have the text of the location showing above the screen. Way too much clutter. The reduced size of the video for editing issue started with photos several updates ago and now Apple idiotically brought a terrible flaw from photos to videos as well. Ugh.
链接地址:https://developer.apple.com/cn/help/app-store-connect/reference/screenshot-specifications/
I am seeing a bug with the use of iOS 18’s Customize Automatic setting.
When swiping from page view to page view forward and back, the apps’ icon version of dark or light change with each return to that page, constantly…first view the app’s icon is light, return view and it’s dark, then return a next time and it’s back to light.
Going further, switching the Customize dark/normal background setting (the sun icon in top left) resolves once clicked.
Hi Guys,
I saw in iOS 18 (Photos App) that there are buttons (in an scrollview) below the navigation title and inside the navigation bar.
Is there an new API or an method to "clone" this UI without using:
.safeAreaInset(edge: .top, content: {
})
Thanks in advance for any feedback and help!
HI,
I have an older app that used a button with an image in a storyboard that is also localized. The image was just a red button with rounded corners, white stroke outline, and two lines of white text. (actually two words on top of each other)
Now I see that I should be able to create this button with the new xcode button features. I want to try that, by removing the old image and just setting the configuration boxes. I see under the Attributes view, there is the setting with my image fileaname,but no dropdown box to set like "none" or an abiltity to remove it right there at the setting of it.
I didn't want to delete the button since it would wipe out the connected code etc. I want to be able to translate the two words to other languages as well.
I can't find instructions for this particular task. I guess it's too trivial but I just not figuring it out. I keep deleting the whole button.
And now the constraints are all gone so I need to use the new xcode to set it backup.
thanks for any guidance with the xcode interface!
Chrissie