watchOS is the operating system for Apple Watch.

Posts under watchOS tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

GoogleSignIn swift package breaks my watchOS app preview
I need to install the GoogleSignIn for my iOS application, and I did so. The issue is that the watchOS app inside the project stops working because of build failures that are caused by the GoogleSignIn package. I cannot figure how to fix it, because inside the project settings, that package appears in the list of Frameworks for the iOS target, and is not present into the list of Frameworks for the watchOS target, as you can see in the first image below.
2
1
806
Jan ’24
'Bad file descriptor' error from URL session data task on Apple Watch?
I'm working on an independent watchOS app and I'm testing on the Apple Watch Ultra simulator as well as a couple of real Apple Watch Ultra devices (both have active cellular subscriptions on AT&T, are within 3 feet of their paired iPhones and connected to WiFi, as well). My app has an application delegate which implements the applicationDidFinishLaunching() method and in that method, I register with APNs for remote notifications. When I receive the token in didRegisterForRemoteNotifications(withDeviceToken:), I send the token on to the server that is going to send notifications to the app. When I test this code in the Apple Watch Ultra simulator, it works 100% of the time. When I test the same code on a real Apple Watch Ultra, about 70% of the time, I get the following error message in the Xcode debug console: 2023-05-12 08:32:30.779560-0400 Watch App Prototype[569:586139] PDTask <5110B87C-28D7-48C9-9C68-121C7728FF68>.<2> finished with error [9] Error Domain=NSPOSIXErrorDomain Code=9 "Bad file descriptor" UserInfo={_kCFStreamErrorCodeKey=9, _kCFStreamErrorDomainKey=1, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataPDTask <5110B87C-28D7-48C9-9C68-121C7728FF68>.<2>", "LocalDataTask <5110B87C-28D7-48C9-9C68-121C7728FF68>.<2>" ), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataPDTask <5110B87C-28D7-48C9-9C68-121C7728FF68>.<2>} 2023-05-12 08:32:30.780401-0400 Watch App Prototype[569:586139] Task <5110B87C-28D7-48C9-9C68-121C7728FF68>.<2> finished with error [9] Error Domain=NSPOSIXErrorDomain Code=9 "Bad file descriptor" UserInfo={_kCFStreamErrorCodeKey=9, _kCFStreamErrorDomainKey=1, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <5110B87C-28D7-48C9-9C68-121C7728FF68>.<2>", "LocalDataPDTask <5110B87C-28D7-48C9-9C68-121C7728FF68>.<2>", "LocalDataTask <5110B87C-28D7-48C9-9C68-121C7728FF68>.<2>" ), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <5110B87C-28D7-48C9-9C68-121C7728FF68>.<2>} The operation couldn’t be completed. Bad file descriptor I ran across a post from someone else about the same problem on StackOverflow. I'm not sure what to make of this error but here's the code that I'm using to send the URL request: func perform(_ urlRequest: URLRequest) async throws -> Data { let (data, response) = try await urlSession.data(for: urlRequest) guard let httpResponse = response as? HTTPURLResponse else { throw NetworkError.serverSideError(response: nil) } guard (200...299).contains(httpResponse.statusCode) else { throw NetworkError.serverSideError(response: httpResponse) } return data } For what it's worth, urlSession is the shared URLSession instance. Again, this error never occurs in the simulator but it happens on both of the Apple Watch Ultra devices and I would say it occurs about 70% of the time. Can anyone help me understand this error message?
3
3
1.2k
Aug ’23
Developer Mode on Apple Watch always 'disabled'
Hi to all, I'm new to WatchOS development and trying to install the default Xcode 'Hello World' app on my Apple Watch Ultra. 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!
4
0
1.3k
Sep ’23
How long does Apple Watch keep HealthKit data?
I would like to create an Apple Watch only app that queries data such as blood oxygenation, heart varibility, number of steps, energy consumed, and other data of a similar nature recorded over the past month and performs calculations on them. I read from the HealthKit documentation that Apple Watch synchronizes data with iPhone and periodically deletes older data, and that I can get the date from which the data is available with earliestPermittedSampleDate(). Is there a risk that in general, by making queries to retrieve data up to a month old, the data will no longer be available? I need the app to work properly without needing an iPhone.
4
0
785
Jun ’24
Opening a Safari URL from an interactive widget with AppIntents
My app allows users to store URLs for future reference. It also has widgets that display these saved items. I want to make these widgets interactive by opening the linked content in Safari without having to open the main app. The issue is that UIApplication.shared.open is not available in app extensions. And this is a problem since widgets are app extensions. Are there alternative methods to accomplish this scenario, or is it currently unsupported?
1
1
947
Jul ’23
Migrating to WidgetKit, issues with editing Watch Faces on iPhone
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?
5
0
1k
Jun ’24
Xcode 15 beta 2 doesn't see my Apple Watch Ultra(watchOS 10), but Xcode 14.3.1 does
iPhone: iOS 17.0 (21A5268h) Apple Watch Ultra: watchOS 10.0 (21R5295g) Xcode: Version 15.0 beta 2 (15A5161b) macOS: 13.4.1 (22F82) Xcode 15 beta 2 doesn't see my Apple Watch Ultra(watchOS 10), but Xcode 14.3.1 does. However, I cannot run on Xcode 14.3.1 because it doesn't support iOS 17 and watchOS 10. Really frustrated, wasted all night debugging and failed. Maybe I have to return my watch to Apple Store on the weekend.
6
1
3.3k
Aug ’23
WatchOS App Review Rejected for UIRequiredDeviceCapabilities
First issue - this is an autonomous WatchOS app. So I'm unsure about the error about installing on iPhone, Second issue is the typo at the end of the statement ("v"). The message is so very generic and errored I have no idea what to correct. What I need help with: Following the link provided and looking under "Discussion" one finds: For a list of the features that different devices support, see Required Device Capabilities. When you follow that link, one only finds settings for Vision, iPhone, iPad, and IPod Touch. What required settings am I missing? What do I need to register as UIReqiuredDeviceCapabilities specifically for an autonomous WatchOS app? My guess is I have some build setting(s) wrong even though this is built from the WatchOS app template. How do I troubleshoot this to track down what I've done incorrectly? Any help is appreciated. This is the rejection message: Guideline 2.3 - Performance - Accurate Metadata We were unable to install the app on iPhone. The UIRequiredDeviceCapabilities key i> n the Info.plist is set in such a way that the app will not install on v . Next Steps To resolve this issue, please check the UIRequiredDeviceCapabilities key to verify that it contains only the attributes required for your app features or the attributes that must not be present on the device. Attributes specified by a dictionary should be set to true if they are required and false if they must not be present on the device. Resources Learn more about the UIRequiredDeviceCapabilities key.
9
0
912
Sep ’23
"Time in Daylight" HealthKit data type
I'm trying to find out if the new "Time in Daylight" feature in the Health app has a corresponding HealthKit data type that our app will be able to query in the release versions of iOS 17 / watchOS 10. So far, I cannot find any reference such a type in beta documentation. Can someone confirm if this will be available? Please note that this is not an inquiry about data collection for "Time in Daylight." We are successfully seeing samples collected on our Watch/iPhone pair running the latest betas.
2
0
858
Jul ’23
App rejected due to improper use of HKWorkoutSession
Hello everyone. My app has been rejected in App Store review multiple times due to improper use of HKWorkoutSession, but I see no way around this, and I haven't gotten any feedback from Apple telling me how I can get around this, they just say to remove it because the intended use of HKWorkoutSession is to read fitness data, which they say I am not doing. My app is designed to help induce lucid dreams, and it uses constant heart rate readings to do this. It reads the user's heart rate throughout the night (that is, the app is running for around 8 hours). Thus it needs to run as the frontmost app, and it needs to run for 8 hours continuously without user input. The only way I know of to do this is by using HKLiveWorkoutBuilder and HKWorkoutSession. Extended run time sessions do not work because of the 1 hr time limit. I would really appreciate any help with this problem. It is frustrating that Apple's review is providing no suggestions and will not accept my app if it uses HKWorkoutSession, which is essentially the backbone of the app. Thank you.
0
0
475
Jul ’23
Delay when posting Local notification on Apple Watch
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!
0
0
532
Jul ’23
How to launch apple watch app from companion app?
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!
2
0
765
Jul ’23
Title: Issues with NSExtensionMainStoryboard or NSExtensionPrincipalClass in Widget Extensions for iOS 14
I'm working on an app that has the following structure: MyApp MyWidgetExtension MyWatchKitApp -- MyWatchKitAppExtension ---- MyWatchKitAppWidgetExtension Both MyWidgetExtension and MyWatchKitAppWidgetExtension were developed using a shared MyWidgetBundle defined as follows: @main struct MyWidgetBundle : WidgetBundle However, I'm running into an issue when attempting to run this on devices with iOS 14. I get an error stating "App extensions must define either NSExtensionMainStoryboard or NSExtensionPrincipalClass keys in the NSExtension dictionary in their Info.plist." Interestingly, if I remove MyWatchKitAppWidgetExtension, the app installs just fine. But, if I add NSExtensionPrincipalClass or NSExtensionMainStoryboard, when I try to distribute the app to TestFlight, I receive an error stating "Unexpected key NSExtensionPrincipalClass found in extension Info.plist". I'm at a loss as to how to resolve this issue. Does anyone have any suggestions or insights?
2
1
1.1k
May ’24