watchOS is the operating system for Apple Watch.

watchOS Documentation

Posts under watchOS tag

416 Posts
Sort by:
Post not yet marked as solved
1 Replies
423 Views
I am trying to add an Apple Watch companion app to my iPhone app. I have no experience with Apple Watch at all, so I followed the Apple instructions as described on https://developer.apple.com/tutorials/swiftui/creating-a-watchos-app I followed that instruction to the letter, and did not add anything to it, and now have two targets in the project: the original iPhone target, and the Apple Watch target. When I try to build the Watch app, I get the following linker error: error: Build input file cannot be found: '/usr/lib/libobjc.A.dylib'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? The linker command has the following argument on it: -weak_library /usr/lib/libobjc.A.dylib The "Link binary with libraries" option of the "Build Phases" of the Apple Watch target does not have any libraries specified. Does anybody know what the libobjc library is, and what it is used for? Where is this linker flag configured? How can I make this work? EDIT: The -weak_library /usr/lib/libobjc.A.dylib is configured in the Project Build Settings, "Other Linker Flags". It seems to be a basic necessity that was already there before I added the Watch target. When I remove it, I get "Undefined symbol: _main" errors. So it seems to be something fundamental that is required. The question is now why it is not found by the linker. If it matters, the iPhone app has always been Objective-C, but I'd like to start with Swift for the Apple Watch app, so have chosen to create that as a Swift app.
Posted
by baraupp.
Last updated
.
Post not yet marked as solved
2 Replies
711 Views
I can't get the simplest Widget to work. I simply want to present the app's icon. It does what it's supposed to do in the simulator but on the actual device it only says "Please adopt containerBackground API" at the place where the Widget would have shown otherwise. I found out that I am supposed to add .containerBackground(Color.clear, for: .widget) for no reason at all to make this work. However, when I do that, I just get a gray circle where the app icon was supposed to show. The png files should be fine because again on the simulator it works so I have no idea what I am doing wrong. If someone can tell me what I'm doing wrong or if someone can share their Widget class that would be awesome - I literally only want to show my app's icon on the Watch face but I already fail at that, no idea why they made WidgetKit impossible to work with. import SwiftUI import WidgetKit struct IconEntry: TimelineEntry { let date = Date() let icon: Image } struct IconProvider: TimelineProvider { func placeholder(in context: Context) -> IconEntry { return IconEntry(icon: getImageForContext(context, color: false)) } func getSnapshot(in context: Context, completion: @escaping (IconEntry) -> ()) { let entry = IconEntry(icon: getImageForContext(context, color: false)) completion(entry) } func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> ()) { let entry = IconEntry(icon: getImageForContext(context, color: false)) let timeline = Timeline(entries: [entry], policy: .never) completion(timeline) } } struct IconWidget: Widget { let kind: String = "IconWidget" var body: some WidgetConfiguration { StaticConfiguration(kind: kind, provider: IconProvider()) { entry in IconView() .containerBackground(Color.clear, for: .widget) } .supportedFamilies([.accessoryCircular, .accessoryCorner, .accessoryRectangular]) .description(Text("Show the app's icon on a watch face.")) } } struct InlineWidget: Widget { var body: some WidgetConfiguration { StaticConfiguration(kind: "Inline", provider: IconProvider()) { entry in Text("App Title") .containerBackground(Color.clear, for: .widget) } .configurationDisplayName("App Title") .description("Description") .supportedFamilies([.accessoryInline]) } } func getImageForContext(_ context: TimelineProviderContext, color: Bool) -> Image { var fileNameToUse = "iconColor.png" if(!color) { fileNameToUse = "iconAlpha.png" } let displaySize = context.displaySize if(displaySize.width == 0 || displaySize.height == 0) { return Image(uiImage: .init()) } let uiImage = UIImage(imageLiteralResourceName: fileNameToUse).resizeImage(width: displaySize.width, height: displaySize.height) let image = Image(uiImage: uiImage) return image } struct IconView: View { @Environment(\.widgetRenderingMode) var widgetRenderingMode var body: some View { imageFor(widgetRenderingMode) .resizable() .onAppear { print("ICON VIEW \(widgetRenderingMode == .fullColor ? "COLOR" : "ALPHA")") } .containerBackground(Color.clear, for: .widget) } } private func imageFor(_ widgetRenderingMode: WidgetRenderingMode) -> Image { switch widgetRenderingMode { case .fullColor: return Image(uiImage: UIImage(imageLiteralResourceName: "iconColor.png")) default: return Image(uiImage: UIImage(imageLiteralResourceName: "iconAlpha.png")) } } @main struct IconBundle: WidgetBundle { @WidgetBundleBuilder var body: some Widget { IconWidget() InlineWidget() } } extension UIImage { func resizeImage(width: CGFloat, height: CGFloat) -> UIImage { let edgeLength = min(width, height) let newSize = CGSize(width: edgeLength, height: edgeLength) UIGraphicsBeginImageContextWithOptions(newSize, false, 0.0) self.draw(in: CGRect(x: 0, y: 0, width: newSize.width, height: newSize.height)) if let resizedImage = UIGraphicsGetImageFromCurrentImageContext() { UIGraphicsEndImageContext() return resizedImage } else { return UIImage() } } }
Posted
by Watcher03.
Last updated
.
Post not yet marked as solved
1 Replies
330 Views
Users want to be able to launch my app from their watch face. I'm not interested in any dynamic updates etc., I literally just want to display my app's icon and be done with it. Using WidgetKit I have written a class that resizes my app's icon to the TimelineProviderContext.displaySize and that works for 50% of the Watch faces. However, some watch faces require the icon to be black and white whilst on other watch faces you can use colors. If you use a color icon on a watch face that expected a black-and-white (or alpha channel) image, it will just display a gray circle. How am I supposed to handle the 2 different color schemes in the watch faces? I have checked for TimelineProviderContext.family.description now to see if I can differentiate it based on that however this leads to contradictions as well; it says accessoryCircular for the "Activity Digital" face (which supports color) but also for for "California" face (which does not support color). What other value can one check for in order to know whether the watch face allows a color icon? I always hated setting up complications in watchOS, they couldn't have done it worse for developers who just want the icon to show up on the Watch face, not even providing a simple sample (I'm happy to get corrected on this) but with WidgetKit it seems impossible to achieve anything at all
Posted
by Watcher03.
Last updated
.
Post not yet marked as solved
0 Replies
405 Views
Hi, I'm trying to build an app for WatchOS and want to add a translucent capsule with a background blur to blur my text behind it. I tried asking ChatGPT, but it couldn't give me a sufficient answer. I would appreciate it if someone could suggest how I could create that background blur. Thanks!
Posted
by David_Akh.
Last updated
.
Post not yet marked as solved
0 Replies
195 Views
Hi, I'm using XCode 15.0.1 to develop a watchOS app. After Product > Archive, I click on Distribute App, but don't see an option for App Store Connect. Also, I notice the Validate App button is grayed out. I made sure Skip Install is No for my app. Any help is appreciated for uploading to TestFlight.
Posted
by sravi6.
Last updated
.
Post not yet marked as solved
0 Replies
353 Views
I have this issue FB13432607 where watchOS synced iCloud contacts just grow and grow and grow: I'm currently over 9 GB of contacts with many duplicate entries. iOS, iPadOS and macOS are also syncing the same iCloud contact store, and they're not showing this issue. I've been reporting feedback for some time, but then I thought, hey, I'm a developer, I can write a watchOS app! After the initial elation and some quick prototyping (it's not a huge amount of code), I came to see that CNSaveRequest is NOT supported on watchOS, which means I can't delete my contacts. (The other option is nuclear: erase all data, restore and re-sync). So writing an app is out, due to lack of API access. Which got me wondering: is my contact store growing because Apple also doesn't have an API to delete contacts on watchOS? If so, this is a huge issue. Any ideas?
Posted Last updated
.
Post not yet marked as solved
1 Replies
1k Views
I added a Watch app to an existing iOS app using XCode 14.1. (single target template) When using WCSession delegate, so I can message between the apps, I always get isWatchAppInstalled = false. If Icreate the same scenario using XCode 13.x, I have no issues. Has anyone been able to add a watch app to an existing iOS app, create a WCSession object and have isWatchAppInstalled = true? print("Session:activationDidCompleteWith --> IsPaired[(String(describing: session.isPaired))] isWatchAppInstalled[(String(describing: session.isWatchAppInstalled))] isReachable[(String(describing: session.isReachable))]"); displays: Session:activationDidCompleteWith --> IsPaired[true] isWatchAppInstalled[false] isReachable[false]
Posted
by wolfulve.
Last updated
.
Post marked as solved
1 Replies
439 Views
Hi, I have been testing an Apple Watch only app on simulator wth no issues. Decided today to try on a device. It builds and deploys then crashes with about with payload. libsystem_kernel.dylib`: 0x472b81d8 <+0>: mov x16, #0x209 0x472b81dc <+4>: svc #0x80 -> 0x472b81e0 <+8>: b.lo 0x472b81fc ; <+36> 0x472b81e4 <+12>: stp x29, x30, [sp, #-0x10]! 0x472b81e8 <+16>: mov x29, sp 0x472b81ec <+20>: bl 0x472ad490 ; cerror_nocancel 0x472b81f0 <+24>: mov sp, x29 0x472b81f4 <+28>: ldp x29, x30, [sp], #0x10 0x472b81f8 <+32>: ret 0x472b81fc <+36>: ret Can anyone shed light on what this might be? I have 5 packages one of which is a 'c' lib. Do not have issues running these on an iOS device however.
Posted
by antokne.
Last updated
.
Post not yet marked as solved
1 Replies
512 Views
We are working on a WatchKit app that streams heart rate data to a companion iOS app. This works very well with WCSession, however, when the WatchKit app sleeps, the data does not continue to stream. The only way to get the data to stream again is by moving/touching the Apple Watch and waking it up again. We tried implementing a WKExtendedRuntimeSession, but we were unable to send data with this session. Is there a way to have data to continue to stream continuously, even if the watchkit app falls asleep? WatchOS: 8.8.1 iOS: 17.0 XCode: 15.0.1
Posted Last updated
.
Post not yet marked as solved
1 Replies
606 Views
Apple Watch Ultra 2, watchOS 10.2 I'm trying to recognize a finger double-tap gesture in watchOS 10.2 on an Apple Watch Ultra 2 or Apple Watch 9. Apple indicates watchOS will invoke primary watch button of app, but I don't know how to specify button as primary. I've written two small watchOS 10.2 SwiftUI apps to demonstrate the problem. Does anyone see what I'm missing, or can point me to relevant docs? APP #1 - simple one-button tap app. Touching button works, but double tap finger gesture seems recognized by watchOS as blue finger icon appears on top of watch display, shaking back and forth indicating it doesn't know what to do, but doesn't invoke Say Hello button. import SwiftUI struct ContentView: View { // Controls whether You did it message is shown @State private var showingSuccessMessage = false var body: some View { VStack { Button("Say Hello") { // This closure is the primary action for the button showingSuccessMessage = true // After 3 seconds, hide the success message DispatchQueue.main.asyncAfter(deadline: .now() + 3) { showingSuccessMessage = false } } // Toggle the visibility of the success message if showingSuccessMessage { Text("You Did It") } } .padding() } } #Preview { ContentView() } APP #2 - basically same app with tap gesture recognizer. Single touch of text works, but double tap gesture while seemingly recognized by watchOS as blue finger icon appears on top of watch display, shaking back and forth indicating it doesn't know what to do, also won't invoke a touch of the Say Hello text. import SwiftUI struct ContentView: View { @State private var showingSuccessMessage = false var body: some View { VStack { // The view that responds to the tap gesture Text("Tap to Say Hello") .padding() .background(Capsule().fill(Color.orange)) .foregroundColor(.white) .onTapGesture { // The action to perform on tap showingSuccessMessage = true // After 3 seconds, hide the success message DispatchQueue.main.asyncAfter(deadline: .now() + 3) { showingSuccessMessage = false } } // Toggle the visibility of the success message if showingSuccessMessage { Text("You did it") } } } } #Preview { ContentView() }
Posted Last updated
.
Post not yet marked as solved
0 Replies
519 Views
For some unknown reason, my apple watch is unable to sync with Xcode and I am unable to build to my Watch. In the Devices and Simulators window, it always shows my Apple Watch as "Connecting" and switches between the following messages: "Waiting to reconnect to [NAME]’s Apple Watch/Xcode will continue when the operation completes." or "Previous preparation error: Unsupported wire protocol version: This host does not support the wire protocol version implemented by the device." The only change that has happened between the apple watch connecting and the error occuring now is I updated my iPhone to IOS v.17. I have tried to restart all devices, Xcode, Reinstall Xcode and nothing has worked. One thing to note is I am not apart of the Apple Developer Program so I will not have access to any of the diagnostic tools apart of that membership to diagnose this issue.
Posted Last updated
.
Post not yet marked as solved
0 Replies
412 Views
I keep getting the error messages: "xcodebuild[4944:159459] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore" and "Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore" I think I didn't properly install all the command line tools, but I'm not sure what to install. How do I install the proper dependencies or fix the issue when getting the app code to run on a device emulator? Do I need to install the watchOS emulator to get it to run?
Posted
by melee23.
Last updated
.
Post not yet marked as solved
1 Replies
631 Views
Ever since updating to watchOS 10, my series 7 Watch with Cellular and no active plan has been experiencing major battery drain issues. After receiving full charge, the battery is drained completely within about 3-4 hours, which was not the case prior. There was no noticeable change with the 10.1 public update which mentioned specifically that it resolves issues with some users experiencing rapid battery loss. Being so disappointed, I submitted an issue report to Apple with the details including the fact that the battery health percentage was at 87%. (Don’t know what it was prior to the v10 update). My frustration with the problem then led me into enabling beta updates for my watch and I proceeded to install the beta version 10.2 as I saw users in some forums stating it resolved their issues. Needless to say, after updating, the watch worked normally for a few hours, noticed it was dead, put it to charge (with a known working charger), and now it’s been several days in which it does not turn on no matter the combination of button presses or state of charging. The only indication of life I see is that sometimes a visual of the charging puck with a red voltage symbol appears when I place it to charge. It doesn’t boot whether I leave it charging over night or just sitting there. This is the first time I’ve been dissatisfied with an update released by Apple. Now I have to go out of my way to get it working again. Would love any suggestions before I am forced to go speak to a Genius...
Posted
by PLGuerra.
Last updated
.
Post not yet marked as solved
1 Replies
477 Views
So I have an iOS app that I inherited written in MS Visual Studio and it worked last year. I had to update it with a new cert and when I did, now I get this error when publishing via Transporter: Asset validation failed (90906) Missing Info.plist value. A value for the key “WKApplication”, or “WKWatchKitApp” if your project has a WatchKit App Extension target, is required in “epass.iOS.app/build/Release-iphoneos/epass.iOS.app” bundle. For details, see: https://developer.apple.com/documentation/watchkit/creating_independent_watchos_apps/setting_up_a_watchos_project (ID: 629ed136-f531-4079-87c2-f91ee6bdcc58) Now I tried adding to the Info.plist: WKApplication WKWatchKitApp That however had no effect. Any thoughts on how to bypass this?
Posted Last updated
.
Post not yet marked as solved
2 Replies
577 Views
I'm working on migrating my app from using CoreData to SwiftData. The swift data code generated by Xcode works correctly for the iOS and Mac Catalyst targets but it is causing a crash for the WatchOS target. It gives me this message **Fatal error: Application must register a ValueTransformer for NSSecureUnarchiveFromDataTransformer ** This attribute is the only one with a .transformable option. @Attribute(.transformable(by: "NSSecureUnarchiveFromDataTransformer")) public var linkedEntities: [UUID] = [] Changing the string NSSecureUnarchiveFromDataTransformer to NSValueTransformerName.secureUnarchiveFromDataTransformerName.rawValue causes a generic crash with no error message. The app has CloudKit integration as well (not sure if relevant). Does anyone have a similar issue and can help me on what to do here?
Posted Last updated
.
Post not yet marked as solved
1 Replies
726 Views
Hello, When I open Watch application on any of my IPhone simulators it says "Simulator Not Paired"... you can pair in Xcode Devices window. The problem is that there is no "PAIRED WATCHES" section there like shown in the help. when I run the xcrun simctl list command I see a lot of devices listed and even some paired. See the command output below. The problem started when I installed Xcode 15. When I had Xcode 14 the watches were paired with the devices and everything worked. I can actually only see the IPhone 15s and watches with watchOS 9.4 and 10. May be that is a part of the problem. Do I have to somehow delete them all and reinstall the latest? Thanks
Posted
by jsuse.
Last updated
.
Post not yet marked as solved
2 Replies
379 Views
Hello, For my first watchOS app, I want use a navigationLink for switch to a new view, but the button does not work. Can you help me ? import SwiftUI struct ContentView: View { @State var timerVal = 1 @State var secondScreenShow = false @State private var selectedColor = "30s" var body: some View { VStack { NavigationLink ( destination: SecondView1() , isActive: $secondScreenShow, label: { Text("GO") }) } } } struct SecondView1: View { var body: some View { VStack { Text ("second view1") } } } struct ContentView_Preview: PreviewProvider { static var previews: some View { ContentView() } } Thank you
Posted
by MaximeHae.
Last updated
.
Post not yet marked as solved
0 Replies
460 Views
Project Info:A music player iOS App with watchOS app embedded. Project Structure: app target: music intent extenstion: intent (for iOS platform) watchOS app target: watchKit watchOS extension: watchKit Extension iOS app use intent extension to support SiriKit with play media intent, it works very well. now i want to support Siri on watchOS app, but i don't know how. i have tried to add new watch extension target, but it doesn't work. i t keeps saying "my app doesn't support *** instruction". Please share if I have missed to read through some documentation / reference that solves this problem.
Posted
by Highmore.
Last updated
.