watchOS is the operating system for Apple Watch.

Posts under watchOS tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

WatchOS IntentTimelineProvider recommendations
Hi! I have an Apple Watch app that provide widgets (circular, corners and InLine) to my users. I use the IntentTimelineProvider.recommendations method to provide the preconfigured widgets but only 16 first seems to be displayed. Is there an implicit limit of 16 items or I am doing something wrong? https://developer.apple.com/documentation/widgetkit/intenttimelineprovider/recommendations()-5ltr5
0
0
313
Sep ’23
WatchOS app crashes when using .topBarTrailing toolbar item placement
I'm running into an issue with using .topBarTrailing placement for a toolbar item. The app fails to launch (crashes) with this placement. The following view works fine with any other placement (other than .topBarLeading). What am I doing wrong? var body: some View { NavigationStack { Text("Overview") .toolbar { ToolbarItem(placement: .topBarTrailing) { Button { // noop } label: { Label("Add", systemImage: "plus") } } } .navigationTitle("Overview") .navigationBarTitleDisplayMode(.inline) } } I've opted to use .confirmationAction as a workaround, which works fine. It also positions the toolbar item in the same place on the view as the .topBarTrailing placement would. I'm using Xcode version 15.0 and targeting WatchOS 10. Verbose error output when trying to run the app in the simulator: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Layout requested for visible navigation bar, <PUICStackedNavigationBar: 0x100e1e8d0; baseClass = UINavigationBar; frame = (0 0; 198 60); opaque = NO; autoresize = W; layer = <CALayer: 0x60000027c280>> delegate=0x101877800 standardAppearance=0x60000261cc60, when the top item belongs to a different navigation bar. topItem = <UINavigationItem: 0x100f11230> title='Overview' style=navigator, navigation bar = <PUICStackedNavigationBar: 0x100f22a80; baseClass = UINavigationBar; frame = (0 0; 198 60); opaque = NO; autoresize = W; layer = <CALayer: 0x6000002887c0>> delegate=0x101069600 standardAppearance=0x60000261f3c0, possibly from a client attempt to nest wrapped navigation controllers.'
1
1
790
Sep ’23
Privacy sensitive label is not redacted when watchOS 10 is locked
I am not sure if is it watchOS 10 regression, but running my widget on Apple Watch I can see Label which is supposed to be rendered redacted when Apple Watch is not on my wrist. I use the .privacySensitive() modifier by it seems not to do anything. I can use the isLuminanceReduced environment in combination with .redacted(reason: .placeholder) which works when the wrist is not raised. But there's no environment AFAIK to know when the watch is locked. BTW .redacted(reason: .privacy) don't do anything either, I have to use .placeholder. Is anyone else having issues with privacy on Apple Watch when using the .accessoryRectangular widget family? Talking about regular widget, not the Smart Stack.
2
1
512
Nov ’23
SwiftUI on WatchOS 10: how to hide page indicator?
I want Tab View to hide the page indicator as I have my own custom page indicator already. TabView(selection: $selection) { ForEach(0...10, id:\.self) { index in Button("tap \(index)") { selection = Int.random(in: 0...10) } } } .tabViewStyle(.page(indexDisplayMode: .never)) This works fine on watchOS 8 and 9. But WatchOS 10 does not work as intended. When the view first appear, the indicator show. When scroll with finger, it does hide the indicator. When jump to some pages by tap the button, the indicator shows again. I'm using Xcode 15.0, testing on watchOS simulator 10.0 I want this to completely hide the page indicator.
1
0
558
Oct ’23
Seizure Alert App requiring continuous background execution
Hello! I am a student at a tertiary Epilepsy Center. Our team is building an open source seizure alert app for the apple watch that will undergo a clinical trial. A well conducted clinical trial is crucial for convincing insurance to pay for apple watches, which correlates with tech adoption. This imposes some restrictions on data collection. Our use case requires that the app run continuously as seizures are not predictable. The documentation on extended runtime sessions recommended the smart alarm mode which lasts for 30 minutes. Individuals would not use an alarm system that only works 30 minutes at a time. Is there any way we could deploy the alarm continuously? The requirements for the background execution are two fold: During model development phase the app would need to continuously collect data from accelerometer, gyro-meter, magnetometer, blood oxygen and EKG. I understand these are very demanding tasks so even one sensor would be good to start with. The app would then upload this to a server over the web (perhaps using CloudKit). If continuous data collection is not possible then what is the longest guaranteed latency between samples? What amount of CPU usage would be permissible and how would it impact sampling rates? During deployment the app would need to run an ML model in the background continuously. We have chosen a light-weight model[1] that has been optimized for mobile devices. It has ~ 1.3 million parameters. What would be the maximum guaranteed latency for running a ML model in the background? Please let me know if you need any more information. Thank you. Reference: Lightweight Transformers for Human Activity Recognition on Mobile Devices, Sannara EK, François Portet, Philippe Lalanda. arXiv:2209.11750
0
0
503
Sep ’23
Issues with tint color not showing on Multicolor watch faces
I use the widget as a complication. Inside the widget, I have a Label and Image. I use SF symbols for the image. It should be possible to set the image colour in the code. I tried .tint() and .foregroundStyle(). I think my colour should be visible when selecting Multicolor tint varian. How to set an accent colour for an SF symbol inside a widget? Is anyone else having issues with this? My image just renders white on a black background. watchOS 10 Xcode 15 RC
0
0
447
Sep ’23
iOS 17 Companion watch app not installing on device during development
Prior to updating, during development of my ios app with watch os companion app, the watch app would install itself onto the watch every time i built the ios app. Since updating, it no longer does this. No code has changed. I have tried resetting the watch, reconnecting, clearing support files, restarting, etc. Any one else been experiencing this? It totally breaks the development workflow.
2
1
582
Sep ’23
Trying to connect an Apple Watch on your phone
Hello Ashley, I’m trying to connect your Apple Watch on my phone and it kept asking to set up an Apple Watch via image scan or manual set up thing but I’ve been trying to fix this issue but no answer so the only option is close the Apple Watch app so it’s just saying pairing failed your Apple Watch couldn’t connect to your phone so it’s just a issue with this app so I closed it and reopened it lot of times and it says connecting your Apple Watch this may take A moment and then it says activating your Apple Watch this may take a few minutes any ideas to fix this problem?
1
0
206
Sep ’23
Using .mixWithOthers or . duckOthers when setting category of AVAudioSession.sharedInstance gives error in WatchOS10
Hi, I have an audio playing Watch app that uses the shared AVAudioSession to play audio. Until WatchOS10 it was working fine, with the session configured as follows: try AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playback, mode: .default, policy: .longFormAudio, options: [.mixWithOthers]) But in WatchOS10, the following error is thrown The operation couldn’t be completed. (OSStatus error -50.) Using a category of [.duckOthers] produces the same error. Setting the category options to [] does not throw the error, but now the audio is not mixed with other system audio. Anyone else having this problem, or have a solution? Thanks Rich
4
0
585
Sep ’23
Memory leak in watchOS app
I have been working on an watchOS version of my iOS app using SwiftData. I have a TabView and on one of the views there is a plus button in the bottom bar. It contains a navigation link. When I tap it for some reason two of the views are stacked and I have to click the back button twice to pop both. After that, when I navigate to another view in the TabView, the app freezes. I checked this in instruments and apparently in "All heap and Anonymous VM" and also "All heap allocations" it is generating hundreds of thousands of objects with category "Malloc 32 bytes" and responsible library "libswiftCore.dylib" and responsible caller "swift_allocObject." This is happening every second, all while the app is frozen. The body of the file that includes the plus button(only watchOS): List(sessions) { session in HStack { VStack { HStack { if session.selected == false { Text(session.name ?? "no name") } else { Text(session.name ?? "no name") .font(.system(size: 12)) Text("(Selected)") .font(.system(size: 12)) } Spacer() } Spacer() HStack { Text(session.cube ?? "no cube") Spacer() } } Spacer() if session.cube == "3x3" { Image(systemName: "square.grid.3x3") .font(.title2) } else if session.cube == "2x2" { Image(systemName: "square.grid.2x2") .font(.title2) } else { Image("4x4") .font(.title2) } } .contentShape(Rectangle()) .onTapGesture { if selectedSession.count &gt;= 1 { if session.selected == true { return } else { withAnimation { selectedSession[0].selected = false usleep(100000) session.selected = true } } } else { withAnimation { session.selected?.toggle() } } } } .navigationTitle("Sessions") .toolbar { ToolbarItemGroup(placement: .bottomBar) { Spacer() NavigationLink { AddSessionView() } label: { Image(systemName: "plus") } } } (Remember that this is only occurring on watches) The body of the file that the plus button goes to: ScrollView { VStack { TextField("Name", text: $name) .font(.caption) .frame(maxHeight: 50) Picker("Cube", selection: $cube) { ForEach(cubes, id: \.self) { cube in Text(cube) } } .onChange(of: cube) { getImage() } .frame(minHeight: 50) Button("Create") { if name != "" { if cube == "Playground" { playground = true cube = "3x3" } let session = Session(name: name, cube: cube, image: image, pinned: false, selected: false, playground: playground) modelContext.insert(session) if playground { playground = false } dismiss() } } } } The getImage() function that the onChange calls: private func getImage() { switch cube { case "3x3": image = "square.grid.3x3" case "2x2": image = "square.grid.2x2" case "4x4": image = "4x4" default: print("this will never execute") image = "square.grid.3x3" } } Any help appreciated.
0
0
553
Sep ’23
On watchOS NavigationSplitView Always Creates Detail Views from Scratch
I am writing a watchOS app using NavigationSplitView. I notice that whenever I switch to a new item in the list, that its associated detail view is always recreated. In other words if I am in the detail view for List item 1, switch back to the List, tap on item 2, switch back to the List from item 2, and choose List item 1 again the detail view associated with item 1 is recreated from scratch. I verified this same behavior with the sample Back Yard Birds app from WWDC 23. I was expecting that with a short list of items (like I have) that the views wouldn't need to be recreated each time and would just be brought back into the view hierarchy. I am wondering if the behavior I am observing is expected or if there is something I can do to not have the views recreated each time. Any insights are appreciated. Thanks, Rob
0
0
340
Sep ’23
Can we use Apple Watch sensors all day long with no limit?
I'm student from Korea. I'm interested in apple things. I have several questions about Apple Watch sensors such as ECG(Electrocardiogram), Heart rate, Oxygen Saturation, breath rate, atrial fibrillation(afib) and so on. First of all, Can I use these sensors all day long? with no limit? I'm planning to develop some healthcare application using Apple Watch with sensors. I can't find examples of using sensors 24/7. And Second, If I can use the sensors all day long, can I execute the app in background? Finally, If I can execute the app in background, can I activate the sensors in background? Thank you for your help. I have tried searching developer guide, and searching the GitHub.
1
0
694
Sep ’23
watchOS 10. GPS locked to Watch - Developer has no choice to select phone's GPS?
Under watchOS10, seems like Apple Watch always uses watch GPS and cannot use iPhone's GPS, previously developer somehow can use either Apple Watch or iPhone's GPS, when iPhone is around the Watch and if developer choose to use iPhone's GPS, then iPhone's GPS will be used in watch app. However, watchOS10 behavior is different where Watch's GPS is always used. Is it the new behavior for watchOS10 ?
0
0
269
Sep ’23
requestWhenInUseAuthorization never shows dialog on watchos
I have a combined iOS + WatchOS app that has worked fine on iOS 16 and WatchOS 9, but on iOS17 / WatchOS 10 I have location permission issues. As you can tell from the previous sentence, all plist entries are set and asking for location updates when the app is in foreground worked fine on the watch on WatchOS 9, however since switching to Xcode 15 things have stopped working. What happens now is: I call locationManager.requestWhenInUseAuthorization() on the watch, which doesn't do anything. I do not get the popup asking for location permissions and none of the delegate methods are called on locationManager. However as soon as I do the same call on my iOS app I get the popup on my phone and immediately the delegate is called in my watch app. So right now the only way of getting location permissions from the user is inside the iOS app, not the watch app. Has anyone else encountered this? Is there a solution?
2
0
683
Oct ’23
Toolbar and title disappear when interacting with view
Hello! I'm developing a Watch app, that's required to receive images from iPhone occasionally. Since the user will need their hands free, they have to inspect those images on Watch, which is why I added a rudimentary image viewer, allowing users to zoom in on images and pan around. As soon as the user pans or zooms, toolbar and title will disappear. This happens in simulator and on my colleague's Watch (A2376), but not on mine (A2356)! Tested both on watchOS 9.6.2 and 10.0.1. Here's a code excerpt: // View is presented on a sheet TabView(selection: $viewing) { ForEach(images) { reference in reference.img .resizable() .aspectRatio(contentMode: .fit) .scaleEffect(scale) .offset(offset + draggingOffset) .frame(width: screenSize.width, height: screenSize.height-1) .clipped() .id(reference.id) .gesture(panGesture, including: .gesture) .gesture(tapZoomGesture) .navigationTitle(viewerTitle) // .toolbar(content: { // ToolbarItem(placement: .cancellationAction) { // viewerToolbar // } // }) .focusable() .digitalCrownRotation(detent: $scale, from: 0.5, through: scaleMax, by: 0.1, sensitivity: .low, isContinuous: false, isHapticFeedbackEnabled: false, onIdle: { offset = stickyEdgeOffset }) } }
1
0
471
Oct ’23