WatchKit

RSS for tag

Build apps that leverage watchOS features like background tasks, extended runtime sessions, and access to the Digital Crown using WatchKit.

WatchKit Documentation

Posts under WatchKit tag

136 Posts
Sort by:
Post not yet marked as solved
2 Replies
1.4k Views
I’ve created a single-target watchOS app in Xcode 14, but I can’t seem to get ClockKit complications working. I’ve added a CLKComplicationDataSource class to my watch target, and in the Info pane for my target I have set the CLKComplicationPrincipalClass key to MODULE-NAME.ComplicationController I haven’t yet added Complication placeholder images to my Assets.xcassets, but as far as I am aware, that shouldn’t be a problem while I am still testing. However, when I run it on a watchOS simulator, the complications never show up on the watch complications list when adding a complication. All of the tutorials I can find for ClockKit complications reference older two-target WatchKit apps. Do the newer single target apps no longer support ClockKit? If so, how can I make a two-target WatchKit app with Xcode 14? Unfortunately I cannot use WidgetKit for my complications because I need to support watchOS 7 at least, and WidgetKit only supports watchOS 9+ Thanks for your help
Posted
by
Post not yet marked as solved
2 Replies
1.1k Views
I am trying to add a watch extension to my existing iOS app. I added a new watch target and I see the new single watch app folder (no extension folder anymore). I also added the watch target as a dependency (embedded content / target dependency) to my app target. I also made sure the bundle identifier of the watch target matches the apps identifier + .watchkitapp But when I try to archive the app and choose validate, I get the error that the watch info.plist is missing the WKWatchKitApp property. So I add it via the Info tab on the watch target. (Which creates a new info.plist file that only contains this single property) When I try again, the build fails with this: Error (Xcode): WatchKit App doesn't contain any WatchKit Extensions. Verify that the value of NSExtensionPointIdentifier in your WatchKit Extension's Info.plist is set to com.apple.watchkit. So I add <key>NSExtension</key> <dict> <key>NSExtensionPointIdentifier</key> <string>com.apple.watchkit</string> </dict> to the watch info.plist but the build error remains. I am a bit lost here, as all questions and tutorials refer to the old Xcode style.
Posted
by
Post not yet marked as solved
1 Replies
969 Views
We're currently trying to develop an Apple Watch companion app for our iOS app using the new WatchOS 9 which has the VoIP call capabilities. Is there a way to mirror VoIP notifications similarly to push notifications between the WatchOS app and iOS app? Essentially we'd like to be able to send a VoIP notification to the iOS app and have the answer/decline call screen show up in both the iPhone and Apple Watch. Currently when we send a VoIP notification to the iOS app, the Apple Watch does not receive anything. Push notifications and local notifications work just fine.
Posted
by
Post marked as solved
3 Replies
1.1k Views
I have an iPhone app the uses CloudKit for Core Data syncing. I also have a companion Apple Watch app that syncs to the same CloudKit records. The watch can be used without the iPhone app as well but they both independently sync to the same CloudKit database. This works reasonably well. As soon as either app is opened, the CloudKit will pull down the latest records. I'd like to add a watch complication that shows the state of the CloudKit records. I supported this by adding a Widget extension, embedded in my watch app. The Core Data database in the watch app is part of an app group, so the complication is able to query the same database. So far so good. I'm running into problems with the complication updating after remote records are changed from the iPhone. Here is what is happening: When records are changed on the iPhone, the data syncs to CloudKit but the watch app is not updated when in the background. This is noticed when you open the app and it takes a second for the view to show the new records. Since Core Data database on the watch is not being updated while in the background, the complication is not being updated at all. Part of my confusion is I assumed CloudKit was meant to make this more seamless with silent push notifications? I have the "Remote Notifications" capability enabled on my WatchApp. It seems that only works while the app is in the foreground though. This seems very limiting when you have a complication that depends on the Watch app's Core Data state. I have a few things to work around this with mixed success: "Wake" the watch app explicitly when records are changed on the iPhone app using WatchConnectivityManager. The hope is that by waking the watch app, it will sync with iCloud. This either isn't working or intermittenly works. It is also not clear to me that by activating the watch app, that it will trigger records to sync. I wish there were a way to ask Core Data to sync explicitly. Whenever the Apple watch app wakes in the last step, ask it to WidgetCenter to reload the widget. This process feels convoluted and seems to negate some of the the benefits of CloudKit to synchronize data which I thought would be baked into this process. Any thoughts on a better approach to all this?
Posted
by
Post not yet marked as solved
1 Replies
823 Views
Hi, Why I cannot see 'Include Complication' option when I am trying to create a new watch app project in xcode?
Posted
by
Post not yet marked as solved
1 Replies
732 Views
Hello, I tried to use the new underwaterDepthPrompt and underwaterDepthCriticalPrompt with WKInterfaceDevice.current().play(_:) without any success on my A2157/WatchOS 9.5.1 (others are working perfectly). Is it normal?
Posted
by
Post not yet marked as solved
0 Replies
478 Views
Hi there, I'm trying to figure out how to make my app always on top when waking the apple watch, just like the native Workout app does. I've noticed the official guidance for users to enable this behavior, but how can I introduce it into my own app? Any answers will be appreciated! Reference to apple support: https://support.apple.com/en-sg/guide/watch/apd748b87e2a/watchos -> Wake to your last activity
Posted
by
Post not yet marked as solved
1 Replies
737 Views
I want to create interactive watch face widget in a way, so user can see some data from my app on the Watch Face widget and then tap on the widget (complication) to change the data without moving inside the app. Does it possible? Or after the tap user always will be moved inside my app? I saw interactive widgets was introduced for iOS and macOS on WWDC23 https://developer.apple.com/videos/play/wwdc2023/10028. But can smth like that be developed for WatchOS?
Posted
by
Post not yet marked as solved
0 Replies
314 Views
When will the Watch be able to monitor blood pressure?
Posted
by
Post not yet marked as solved
1 Replies
1.1k Views
Isn't it possible to use the same widgetkit extension for both iOS and WatchOS? In the WWDC's BackyarBirds project from Apple, I can see the widget extension is added to both the multiplatform (including iOS) and the watch targets. I can also see that the SwiftUI code even uses macros to check which platform the code is running on. However, I'm having several issues with adding the same extension to both targets. When I add it to the watch target, I get a build error that I'm trying to embed an application that also builds for iOS and that is not allowed for the watch app. Not sure if any code here is helpful, but this is my widget UI code: struct AkvaWidget: Widget { private let kind = "Akva Widget" var families: [WidgetFamily] { #if os(iOS) return [.accessoryCircular, .accessoryRectangular, .systemSmall] #elseif os(watchOS) return [.accessoryCircular, .accessoryRectangular, .accessoryInline, .accessoryCorner] #endif } var body: some WidgetConfiguration { StaticConfiguration( kind: kind, provider: AkvaSnapshotTimelineProvider() ) { entry in AkvaWidgetView(entry: entry) } .configurationDisplayName("Akva") .description("Keep track of your water intake.") .supportedFamilies(families) } }
Posted
by
Post not yet marked as solved
0 Replies
776 Views
Anyone who has successfully migrated to using WidgetKit for their Apple Watch complications, your help would be greatly appreciated! I've migrated to WidgetKit for my Watch app. On the Apple Watch Face Editor, the new Widget names and options appear correctly. However, on the iPhone Apple Watch app, it offers both WidgetKit and old ClockKit complications... this should not be. I also have found rendering issues where Watch Faces on the main My Watch tab have blank gaps for WidgetKit complications, when selecting the Watch Face they then render (see photos) I've put in a feedback FB12460375 Have tried a full clear and reinstall of my app on both devices, no change. This issue occurs on WatchOS 9.5.2 / iOS 16.5.1 and WatchOS 10 Beta 2 / iOS 17 Beta 2 Any other ideas?
Posted
by
Post not yet marked as solved
0 Replies
501 Views
Hello and good luck. I am a watchOS application developer. When watchOS was updated to 9.5.2, I used Xcode14.3.1 to report an error during real-device debugging. This troubled me a lot. Please help me to find out what caused it. I have already Upload the error message, which really delays my application development progress. XcodeError
Posted
by
Post not yet marked as solved
0 Replies
684 Views
My App includes iPhone + Watch. Then, I carried out the app transfer, After app transfer, I could only see the bundle ID for iphone, but could not find the bundle ID for watch. So I tried to recreate the missing watch bundle id and got an error: An App ID with Identifier 'com.***.watchkitapp' is not available.Please enter a different string. I guess the Bundle ID is duplicate, so I created a non-duplicate Bundle ID to develop, it is ‘com.***.watchapp’, by the way, I want to migrate to SwiftUI. When I finished the development and uploaded the new ipa, I got another error: Invalid Bundle Identifier. Attempting to change bundle identifier from com.***.watchkitapp to com.***.watchapp is disallowed for bundle *** Watch App.app I can't do anything now. What am I supposed to do
Posted
by
Post not yet marked as solved
0 Replies
456 Views
I have created widget that shows fine as a widget in the smart stack. But when the same widget is added as a complication (accessoryRectangular) the font sizes (caption) are slightly bigger and don't fit anymore. Have you experience this?
Posted
by
Post not yet marked as solved
0 Replies
556 Views
I have an iOS app with a companion watchOS app. On the main app I set up an auto renewing subscription. By purchasing it you unlock the Apple Watch app. If you are not subscribed, a paywall view is shown in the watch app. If you are, you get to see the whole app. The thing is when a user completes the purchase on the main app, the watchOS view won't update. The Watch Connectivity framework is set up just fine and I get to communicate successfully to/from both devices. But to reflect the new state change, from the purchase made on the phone, I need to close the watch app and open it again. In doing so, the home page opens up and the users will finally get to navigate the app. Is there a way so that upon receiving the message from the Connectivity framework, I get to refresh/reload the view so that the user doesn't have to close the app and open it again? The pseudocode would be: I receive the object from the main app I check that the user has successfully purchased the subscription I reload the app/reload the view so that the user after tapping the app on the watch gets to see the home page with no extra steps. Thank you!
Posted
by
Post not yet marked as solved
0 Replies
468 Views
Hi! I have some trouble with local notification delivery on Apple Watch. It can take more than 1 minute to see the first local notification delivered. I made sure to not use a trigger so the notification will be delivered right away possible as specified in the UNNotificationRequest initializer doc. But there is always a delay for notification delivery. Here is how I'm creating the local notification: content.title = "title" content.subtitle = "subtitle" content.body = "body" content.userInfo = "userInfo" content.categoryIdentifier = "categoryIdentifier" content.threadIdentifier = "threadIdentifier" content.sound = UNNotificationSound.default let notifyRequest = UNNotificationRequest(identifier: stringWithUUID(), content: content, trigger: nil) let center = UNUserNotificationCenter.current() center.add(notifyRequest) { ( error: Error?) in if let theError = error { print(theError.localizedDescription) } else { print("Scheduled OK") } } Do you have any idea how to avoid the delay? Best!
Posted
by
Post not yet marked as solved
2 Replies
637 Views
Is there a way to open an app on Apple Watch from the iOS companion app as Maps is doing? When a navigation is started from Maps in iOS, Maps app starts right away on Apple Watch. Notice that it is not the notification which is started on Apple Watch, it's the real Maps which is automatically launched on Apple Watch. Do you know how to reproduce the same behaviour for any apps in watchOS? Best!
Posted
by