When I try to access the data in my IntentTimelineProvider in the recommendations function using App Groups, it is always empty "no data".
func recommendations() -> [IntentRecommendation<IndicatorIntent>] {
if let sharedUD = UserDefaults(suiteName: "group.measurements") {
let jm = JanitzaMeasurementValue(identifier: "1", display: "2")
let intent = IndicatorIntent()
intent.indicatorWidgetData = jm
let desc = sharedUD.string(forKey: "string") ?? "no data"
return [IntentRecommendation(intent: intent, description: desc)]
}
return []
}
Although I write this in both the watchOS and iOS app using App Groups.
if let sharedUD = UserDefaults(suiteName: "group.measurements") {
sharedUD.set("test", forKey: "string")
}
What is the right way to dynamically implement the widgets for Complications in watchOS?
Like for example in Shortcuts App.
**Thanks for support **
Posts under watchOS tag
200 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Hey guys,
I'm creating a fitness app on WatchOS and I need to realize a focus on a variable but it doesn't work.
I will show you my code to understand the problem :
@State var WeightChoose: Double = 0.0
@FocusState private var isWeightActive: Bool
var body: some View {
HStack {
Text("Poids:")
Spacer()
Text("\(String(format: "%.0f", WeightChoose)) KG")
.focused($isWeightActive)
.foregroundColor(isWeightActive ? .green : .white)
.digitalCrownRotation($WeightChoose, from: 0.0, through: 300.0, by: 1.0, sensitivity: .medium)
.animation(.easeIn(duration: 1), value: WeightChoose)
.padding()
Here my code don't show me any error but the focus doesn't work at all.
Before, I used the old way to focus with
@State private var isWeightActive = false
instead of @FocusState
and
.focusable(true) { focused in
isWeightActive = focused
}
Instead of .focused()
But now the .focusable() method is depreciated since watchOS 8 and we have to go on FocusState and .focused but it doesn't work for my code.
If you could help me with that it would be awesome.
Thank you
Cyrille
I've encountered a major issue with the iOS 18.1 RC and watchOS 11.1 RC. It appears that complications running on WidgetKit cannot be synced as .watchface to these new release candidates. The error message indicates that "the Watch Faces app and complication are not available," which is affecting all apps utilizing WidgetKit.
This issue renders all WidgetKit-based complications unusable on watchOS 11.1 RC. It’s a serious problem for those of us who rely on these complications for our apps and for users expecting consistent functionality.
APPLE, PLEASE FIX THIS ISSUE ASAP!
This bug is a significant setback for developers and users alike, and any guidance or updates would be greatly appreciated.
Greetings,
i have been watched the video and looked for codes to apply live activity for watch.
problem is in preview always show my widget as medium size even if apply supporting widget family and changing the content of preview to dynamicIsland .compact
however preview still shows me the medium size everytime. what is wrong ?
I have an iOS and watchOS app where both can run independently, I am not using WatchConnectivity to send data back and fourth. The issue I'm having is that if I schedule a local notification on the watch and the phone is unlocked, it will not show on the watch for about 10-15 seconds. If I uninstall the iOS app or have the phone locked, it will show immediately on the watch.
To my understanding, this is somewhat the expected functionality but is there a way to bypass it? My app is a timer app and it really should not have a delay.
WatchOS app is running in the foreground and can wake up the iOS app, but it can't trigger didReceiveMessage in the iOS app.
iOS and Watch apps in the foreground can communicate with each other without any issues. However, when my app is closed, even though it wakes up, it cannot communicate. Any ideas? Should I be using a background task ios app side?
Hi everyone,
I am trying to send a request to my server in my watch application when HKObserverQuery is triggered. This is working fine when my app is in foreground however the request is not sending when the app manually terminated or in background. HKObserverQuery works fine and triggered in these cases however the request is not sending. I researched about URLSessionConfiguration.background and background sessions but I could not figure it out. I don't want to download or upload a file, I just want to send a simple request when HKObserverQuery is triggered.
Can you show me to a path way to make it possible?
I am trying to test my watch app with my iPhone, I am assuming the behavior of these scenarios might be same in both device, am I correct?
let urlsession = URLSession(configuration: URLSessionConfiguration.background(withIdentifier: "enablement"), delegate: self, delegateQueue: nil)
let dataTask = urlsession.dataTask(with: urlRequest)
dataTask.resume()
As shown in the code snippet, I tried to set background configuration to my URLSession.
I enabled background fetch in background modes.
Apple documentation says, dataTask can not run in background -> https://developer.apple.com/documentation/foundation/urlsessiontask However I don't want to perform a long running task such as downloading or uploading.
I'm using Text(date, style: .timer) to display a timer in a WatchOS widget, which works great. The problem is that when the watchface goes dim the time goes from showing the time as "MM:SS" to showing "M minutes". Why is this occuring and how can I change the behavior? I understand it needs to remove seconds to preseve battery life, but why it is putting the word "minutes" at the end, this is messing up my layout. Thanks.
Dear all,
i am a music conductor and developer, and to fulfill my joy with music i recently developed a WatchFace and some apps for a non-apple watch called "PineTime".
My whole development is done in c++ and is available at
https://github.com/luto65/PineConductor/
Since I am aswell an apple developer, and most of my friends have apple watches, i am now porting those c++ apps to the apple watch.
I just finished the very first one, that is actually a watch Face
I now ported it to appleWatch and it looks pretty similar too (here a screenshot from the simulator)
I would like to now remove the annoying digital hour on the top right corner, and then sell it as new custom face, together with my other swift-ports of my original c++ applications.
Looking forward any feedback.
When using a double-tap primary action on a button, there will be a 1 second delay before the action is executed after the double-click is detected. Why is the design not like scrollview, which executes actions after double-tap detection? Is there a way to make the button perform an action after detecting a double-tap?
Can you initiate a live activity from a Watch app? From what I can tell you can only do it from an iOS app and then have the Watch mirror it, is that true?
If you were builiding a standalone timer app for WatchOS for instance and wanted the timer to show up automatically in Smart Stacks when the app is in the background, is this possible?
Thanks
I want to download some large files on watchOS and I found Apple Music app is able to download songs in background and pause downloading depending on battery life. Does there any way to do the same thing in my own app? After users choose to download, keep the downloading task in background and pause/resume on demand.
Im building a workout app to track swimming workouts for watchos 11. Triggering .prepare() on my HKWorkoutSession does not change the session state HKWorkoutSessionState.
Below is my prepare function which should transition the session state to HKWorkoutSessionStatePrepared. Nothing is thrown in the delegates, the state just wont change? I have tried erasing, restarting, use another version of xcode and another simulator runtime.
func prepare() {
guard self.session == nil else {
fatalError("Session already exist")
}
// Configure Workout Type
let config = HKWorkoutConfiguration()
config.activityType = .swimming
config.swimmingLocationType = .openWater
config.locationType = .outdoor
self.Workoutconfig = config
// Create Session
do {
guard store.authorizationStatus(for: .workoutType()) == .sharingAuthorized else {
fatalError("Lack of permission to start workout")
}
let session = try HKWorkoutSession(healthStore: store, configuration: config)
self.session = session
self.builder = session.associatedWorkoutBuilder()
Logger.diveController.info("Successfully created workout session")
builder?.dataSource = HKLiveWorkoutDataSource(healthStore: store, workoutConfiguration: config)
self.session?.delegate = self
self.builder?.delegate = self
if self.session == nil {
fatalError("No workout session created")
}
if self.builder == nil {
fatalError("No workout builder created")
}
self.session?.prepare()
logger.debug("Session Started at: \(self.session?.startDate ?? Date())")
logger.debug("Session State: \(self.session?.state.description ?? "")")
if self.session?.state != .prepared {
reset()
fatalError("Failed To Prepare")
}
} catch {
Logger.diveController.error("Error starting workout session: \(error.localizedDescription)")
}
}
Hi to all,
I'm new to WatchOS development and trying to enable the Developer Mode on my Apple Watch Series 7. I've enabled Developer Mode on my iPhone and did the same on my Apple Watch. After enabling Developer Mode on the watch it asks me to restart the watch. After a restart it asks me again if I want to enable Developer Mode. Of course! I don't succeed in installing the app on my watch because Xcode is "waiting for first unlock" of my watch. When I look in Settings > Privacy > Developer Mode the toggle switch is disabled. I can enable the switch but the watch asks me to restart and this is the loop I'm in.
Anybody suggestions for 'permanently enabling' Developer Mode on my Apple Watch?
Thanks in advance!
Hello everyone!
I want to add hand gesture controls to my Apple Watch app. Specifically, I’m looking to implement the following gestures:
1. Tapping index finger and thumb together once
2. Tapping index finger and thumb together twice
3. Fist clench
4. Double fist clench
Each gesture should trigger a different action within the app.
However, I can’t find any information on how to implement this. I only came across an example using .handGestureShortcut(.primaryAction) (Enabling the double-tap gesture on Apple Watch https://developer.apple.com/documentation/watchOS-Apps/enabling-double-tap), but I need to handle four distinct gestures.
Is this possible in watchOS 11? Any guidance or examples would be greatly appreciated!
Thank you!
I use onPreferenceChange() and onScrollPhaseChange() to detect scroll is triggered by double tap. Is there any way to directly know the scroll is triggered by double tap?
I use onPreferenceChange() and onScrollPhaseChange() to detect the scroll is triggered by double tap.
Is there any way to directly know that the scroll is triggered by a double tap?
Xcode Version 16.1 beta 3 (16B5029d) --
Watch Series 9 Version 11.1 (22R5569a) --
iPhone 16 Pro Version 18.1 (22B5069a)
The current WatchOS version has introduced a UI bug in NavigationView.navigationTitle - and I'm attempting to install a new version of my App on my Watch.
This watch was previously sync'd with an iPhone 13 Pro - which is no longer associated with my AppleID since I'm using my new iPhone 16 Pro.
The watch is paired with the 16 Pro, and in previous versions of Xcode 16.1, I was able to compile and run my all of my apps on the Watch.
In the current beta 3, instead I get a dialog box which states:
Connecting to Apple Watch
Xcode will continue when the operation completes.
and this dialog box persists until the timeout (which is several minutes).
Any help?
I'm scheduling local notifications on my WatchOS app, but they are always alerting exactly 13 seconds later than scheduled. I have read other users having the exact same issue but there is no solution anywhere. I'm not sure how one is supposed to write any sort of timer app when they are always coming in delayed. Any idea why this occurs and how to resolve it? For now I am subtracting 13 seconds from the end time, but that's not really a solution I'm happy with.
Thanks
I'm using Live Activity features in my app, but I want to customize the user experience across different Apple devices. Specifically, I'd like to:
Keep Live Activity enabled and functioning on the iPhone Disable or prevent Live Activity from appearing on the connected Apple Watch
Is this level of device-specific control possible with Live Activity? If so, what's the best approach to implement this functionality? What I've tried:
I've looked through Apple's documentation on Live Activity, but couldn't find specific information about device-level control. I've experimented with ActivityKit, but haven't found a clear way to distinguish between iPhone and Apple Watch when pushing updates.