watchOS is the operating system for Apple Watch.

watchOS Documentation

Posts under watchOS tag

417 Posts
Sort by:
Post not yet marked as solved
0 Replies
310 Views
I'm making a watchOS app, which has WKNotificationScene for dynamic notification, and button for open sms app. I've tried to open sms app via url with following orders, but I always get error below: Press Notification on watchOS, which is made of WKNotificationScene (a.k.a. dynamic notification) watchOS App comes to foreground. Press button, which executes WKApplication.openSystemURL(_:) to open SMS App Error occurs. Failed to open URL sms:01022221111&body=%EB%82%98%EC%A4%91%EC%97%90%20%EC%A0%84%ED%99%94%EB%93%9C%EB%A6%AC%EA%B2%A0%EC%8A%B5%EB%8B%88%EB%8B%A4.: Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.MobileSMS" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (IOSSHLMainWorkspace) for reason: Security ("Entitlement com.apple.springboard.openurlinbackground required to open URLs while backgrounded")., NSLocalizedDescription=The request to open "com.apple.MobileSMS" failed., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0x176bf6b0 {Error Domain=FBSOpenApplicationErrorDomain Code=3 "Entitlement com.apple.springboard.openurlinbackground required to open URLs while backgrounded." UserInfo={BSErrorCodeDescription=Security, NSLocalizedFailureReason=Entitlement com.apple.springboard.openurlinbackground required to open URLs while backgrounded.}}, FBSOpenApplicationRequestID=0xaecb} -[SPApplicationDelegate extensionConnection:openSystemURL:]_block_invoke:2386: Attempting to open url sms:01011112222&body=%EB%82%98%EC%A4%91%EC%97%90%20%EC%A0%84%ED%99%94%EB%93%9C%EB%A6%AC%EA%B2%A0%EC%8A%B5%EB%8B%88%EB%8B%A4. with scheme sms failed: Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.MobileSMS" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (IOSSHLMainWorkspace) for reason: Security ("Entitlement com.apple.springboard.openurlinbackground required to open URLs while backgrounded")., NSLocalizedDescription=The request to open "com.apple.MobileSMS" failed., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0x176bf6b0 {Error Domain=FBSOpenApplicationErrorDomain Code=3 "Entitlement com.apple.springboard.openurlinbackground required to open URLs while backgrounded." UserInfo={BSErrorCodeDescription=Security, NSLocalizedFailureReason=Entitlement com.apple.springboard.openurlinbackground required to open URLs while backgrounded.}}, FBSOpenApplicationRequestID=0xaecb} I've tried to check WKApplicationState.active before executing WKApplication.openSystemURL(_:), but it always failed. Does anyone know how to fix it?
Posted
by blindWM23.
Last updated
.
Post not yet marked as solved
0 Replies
295 Views
Enable Developer Mode - Missing Trust this computer - Missing, if the prompt happens and you accidentally tap the verbiage or the crown before scrolling to the buttons, you never ever see the trust this computer again. Double tapping the side button or crown to kill apps is a game of roulette. If you don’t swipe the app in mere seconds the list disappears or one of the background apps becomes active. After upgrading all watches to 10.4 and pairing to a phone guess what? Enable developer mode - missing. Now I have a few watches that cannot be used for development. When is Apple going to address this glaring bug people have been reporting and talking about in the forums for almost a year with versions of watchos from as early as 9.x and iOS 16?
Posted
by MobileTen.
Last updated
.
Post not yet marked as solved
0 Replies
220 Views
There is a app I’m trying to download on my watch (watchos only app) and it’s not downloading it’s just loading only and it keeps loading until the install button shows up again hours later
Posted Last updated
.
Post not yet marked as solved
1 Replies
576 Views
Hey there, I'm implementing Watch Complications in an existing project, and I'm having the problem that transferCurrentComplicationUserInfo(_:) works exactly as transferUserInfo(_:) is described in the documentation, but not as it should. That is, when the WatchApp is opened, func session(_ session: WCSession, didReceiveUserInfo userInfo: [String: Any] = [:]) receives the data sent by transferCurrentComplicationUserInfo(_:). If not, the data is queued until the Watch App is opened again. In other words, transferCurrentComplicationUserInfo(_:) never wakes up the ExtensionDelegate when the Watch App is not running. Has anyone experienced the same thing and know how to fix it? More details: Testing on iPhone 11 (iOS 17.1.2) and Apple Watch SE (WatchOS 10.2) I made sure that the quota of 50 is not exhausted when I test. The WatchApp is still dual-target (I want to avoid having to migrate to single-target and SwiftUI lifecycle) Watch App code: class ExtensionDelegate: NSObject, WKExtensionDelegate, WCSessionDelegate { let session = WCSession.default override init() { super.init() if WCSession.isSupported() { session.delegate = self session.activate() } } func session(_ session: WCSession, didReceiveUserInfo userInfo: [String: Any] = [:]) { WatchWidgetSessionHandler.shared.processComplicationUserInfo(userInfo) } } IOS App code: class WatchAppDataManager: NSObject, WCSessionDelegate { override init() { super.init() let session = WCSession.default session.delegate = self session.activate() } func sendDataToWidget(for kinds: [WatchWidgetKind]) async { guard WCSession.default.activationState == .activated, WCSession.default.isComplicationEnabled else { return } let widgetsData = dataProvider.getData(for: kinds) if !widgetsData.isEmpty { WCSession.default.transferCurrentComplicationUserInfo(widgetsData) } } }
Posted Last updated
.
Post not yet marked as solved
0 Replies
320 Views
As per iOS SMS sending API, there is no option to send SMS programmatically without user consent. Developer needs to use the MessageUI framework to get iPhone user consent for sending SMS. In that case, if any third party SmartWatch connected through BLE with iPhone received SMS notification through ANCS and want to reply to that SMS, After typing and sending from Watch, user needs to perform this additional step in iPhone - give consent. But if we use Apple watch, this consent in iPhone is not required if Apple Watch is already paired with iPhone. After typing text in Apple Watch, can send SMS to receiver through utilizing iPhone's SMS service without any user interaction. What is the reason of this difference? For sending SMS, iPhone and Apple Watch needs to be paired. Similarly, even third party SmartWatch also performs BLE connection and pair together before sending SMS text from Watch to iPhone to forward to receiver. But in that case why another additional user consent is required in iPhone? If we consider iPhone and Apple Watch case, pairing with each other is considered as user consent for sending any SMS later from Watch utilizing iPhone. Then, why BLE pairing between iPhone and other third party Watch not considered as user consent and additional user consent is required for each time SMS sending?
Posted
by Unique_23.
Last updated
.
Post not yet marked as solved
2 Replies
217 Views
My requirement is to execute this shortcut on the Apple Watch, where I input speech, and it's converted into text to be saved in the memo app. However, the shortcut doesn't function correctly on the Apple Watch, and I can't sync the content to the memo app. Suspecting an issue with synchronization, I added the current time along with my voice input, only to find that while the current time gets transferred, the text does not. I wondered if the problem was with voice input, so I tried switching to keyboard input, but the outcome remained unchanged. I have tested this issue on multiple Apple Watches and found the problem persists across all devices. Both my phone and iWatch are updated to the latest system versions. https://www.icloud.com/shortcuts/d58d14627dbe450ead5e9217e1a68c27
Posted
by jin_asac.
Last updated
.
Post not yet marked as solved
1 Replies
780 Views
I’m working on an independent watchOS app which is primarily designed to to collect and periodically send location updates to a server. The UI features a toggle that allows the user to turn this capability on or off at their discretion. The typical use case scenario would be for the user to turn the toggle on in the morning, put the app in the background and then go about their day. Given the limitations and restrictions regarding background execution on watchOS, in an ideal situation, I would be able to upload the stored location updates about every 15-20 minutes. With an active complication on the watch face, it’s my understanding that this should be possible. I’ve implemented background app refresh and indeed, I do see this reliably being triggered every 15-20 minutes or so. In my handle(_:) method, I process the WKApplicationRefreshBackgroundTask like this: func handle(_ backgroundTasks: Set<WKRefreshBackgroundTask>) { backgroundTasks.forEach { task in switch task { case let appRefreshBackgroundTask as WKApplicationRefreshBackgroundTask: // start background URL session to upload data; watchOS will perform the request in a separate process so that it will continue to run even if our app gets // terminated; when the system is done transferring data, it will call this method again and backgroundTasks will contain an instance of // WKURLSessionRefreshBackgroundTask which will be processed below startBackgroundURLSessionUploadTask() scheduleNextBackgroundAppRefresh() appRefreshBackgroundTask.setTaskCompletedWithSnapshot(false) case let urlSessionTask as WKURLSessionRefreshBackgroundTask: // add urlSessionTask to the pendingURLSessionRefreshBackgroundTasks array so we keep a reference to it; when the system completes the upload and // informs us via a URL session delegate method callback, then we will retrieve urlSessionTask from the pendingURLSessionRefreshBackgroundTasks array // and call .setTaskCompletedWithSnapshot(_:) on it pendingURLSessionRefreshBackgroundTasks.append(urlSessionTask) // create another background URL session using the background task’s sessionIdentifier and specify our extension as the session’s delegate; using the same // identifier to create a second URL session allows the system to connect the session to the upload that it performed for us in another process let configuration = URLSessionConfiguration.background(withIdentifier: urlSessionTask.sessionIdentifier) let _ = URLSession(configuration: configuration, delegate: self, delegateQueue: nil) default: task.setTaskCompletedWithSnapshot(false) } } } And here is how I'm creating and starting the background URL session upload task: func startBackgroundURLSessionUploadTask() { // 1. check to see that we have locations to report; otherwise, just return // 2. serialize the locations into a temporary file // 3. create the background upload task let configuration = URLSessionConfiguration.background(withIdentifier: Constants.backgroundUploadIdentifier) configuration.isDiscretionary = false configuration.sessionSendsLaunchEvents = true let backgroundUrlSession = URLSession(configuration: configuration, delegate: self, delegateQueue: nil) let request: URLRequest = createURLRequest() // this is a POST request let backgroundUrlSessionUploadTask = backgroundUrlSession.uploadTask(with: request, fromFile: tempFileUrl) backgroundUrlSessionUploadTask.countOfBytesClientExpectsToSend = Int64(serializedData.count) // on average, this is ~1.5 KB backgroundUrlSessionUploadTask.countOfBytesClientExpectsToReceive = Int64(50) // approximate size of server response backgroundUrlSessionUploadTask.resume() } Note that I'm not setting the .earliestBeginDate property on the backgroundUrlSessionUploadTask because I'd like the upload to start as soon as possible without any delay. Also, this same class (my WatchKit application delegate) conforms to URLSessionTaskDelegate and I have implemented urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:) and urlSession(_:task:didCompleteWithError:). In my testing (on an actual Apple Watch Ultra running watchOS 9.3.1), I've observed that when the system performs the background app refresh, I always receive a callback to myhandle(_:) method. But when I start the background URL session upload task (in startBackgroundURLSessionUploadTask()), I was expecting that when the upload completes, I'd receive another call to myhandle(_:) method with an instance of WKURLSessionRefreshBackgroundTask but this doesn't seem to happen consistently. Sometimes I do see it but other times, I don't and when I don't, the data doesn't seem to be getting uploaded. On a side note, most of the time, startBackgroundURLSessionUploadTask() gets called as a result of my code handling a background app refresh task. But when the user turns off the toggle in the UI and I stop the location updates, I need to report any stored locations at that time and so I call startBackgroundURLSessionUploadTask() to do that. In that specific case, the upload seems to work 100% of the time but I definitely don't see a callback to my handle(_:) method when this occurs. Am I wrong in expecting that I should always be getting a callback to handle(_:) when a background URL session upload task completes? If so, under what circumstances should this occur? Thanks very much!
Posted
by bmt22033.
Last updated
.
Post not yet marked as solved
1 Replies
307 Views
Hi everyone, We have a sports app that helps track your game scores. Still, when you are in the middle of a game and receive a notification (e.g., an activity notification, a WhatsApp or third-party app), that notification will pop up on the screen, overlapping the app. This forces you to scroll all the way down the notification and close it before you can continue using the app. Some users are complaining about this, and it's indeed very annoying. I was wondering if there's any way to control that during matches, no notifications pop up on your screen (it's ok to have the red dot on top, but having the notification overlapping is what kills the app's usability). Users can avoid this by choosing the right "focus" mode before starting a new match. However, many don't even know this feature exists or how to deal with it. Is there any way to block incoming notifications from appearing on the screen while the app is being executed?
Posted
by Ataliano.
Last updated
.
Post not yet marked as solved
0 Replies
270 Views
Hello Do we have access to the ECG raw data on the apple watch? I was able to access the data using HKElectrocardiogram Class API. "ecgSample" returns all the recorded ECG logs done by the user using the default apple app. I want to access the data in real-time, do the API supports that? That is, I want to create a custom app in which I direct the user towards recording an ecg signal and then do whatever I want with it. Please let me know, that would be very helpful!
Posted
by zein95.
Last updated
.
Post not yet marked as solved
0 Replies
218 Views
In iPhone, if you open Files app and tap on an associated file type, its corresponding app is launched. I have implemented this functionality in my iOS SwiftUI app - associated a file type - .csk, with my iOS app and handled its launch using the onOpenURL(perform:) modifier. WindowGroup { FileContentView() .onOpenURL(perform: { (fileUrl: URL) in Log(String(format: "File Url = %@", fileUrl.absoluteString)) // Update UI with the content of the file }) } I want to achieve the same for my watchOS app. I noticed that the UTExportedTypesDeclaration key, which is used to declare the file types created and owned by the app, is not available for watchOS. But the CFBundleDocumentTypes key, which is used to associate a file type with the app is available. So, I expect my app to respond to taps on those associated file types, but I've run into a snag. There is no Files app in AppleWatch nor is there a way to view my iCloud storage. I have my .csk file (which is associated with the watchOS app) in iCloud. So, how can I test this launch? How can an AppleWatch user tap a file and view it in his app? It should be possible to handle file launches since CFBundleDocumentTypes is available for watchOS.
Posted
by GangOrca.
Last updated
.
Post not yet marked as solved
0 Replies
327 Views
We have a watch app, that contains TabView with two child views. First Child View have a slider control that supports digitalCrownRotation. Second child view have a normal text on the screen “Hello” When app is launched, the slider in the first view got highlighted when user rotates the Digital Crown but when we moved to Second tab and navigate back to first view, and rotates the Digital Crown, the slider view never gets highlighted but the value of Slider gets changed and value gets changed by any step. This issue was introduced after WatchOS 10.2. Prior to WatchOS10.2 everything worked fine. Could you please assist me to find the solution to resolve this issue?
Posted Last updated
.
Post not yet marked as solved
5 Replies
1.4k Views
Got a little app I am trying to build before launch, I've never built a watch only app, and it requires iOS 17 so I'm a bit stuck. When creating a watch only target, it seems that the template is broken. According to this: https://developer.apple.com/documentation/watchos-apps/creating-independent-watchos-apps/ There should be a blank iOS app target, that contains the watch app. The problem is once I go to build and upload the app to test flight, I get a bundle that Xcode has no clue what to do with (Because it only contains the watchkit app, and no containing xcode app.) I'm guessing my only hope might be to create a watch only app targetted at iOS 9 with Xcode 14, then migrating to Xcode 15? I'm trying that now, but I guess I have another radar to file unless I'm missing something.
Posted
by jclardy.
Last updated
.
Post not yet marked as solved
0 Replies
305 Views
Hi all, I am trying to build an app which, on support Apple Watch's (currently just the Ultra's), will detect when the watch has been submerged and will start to report temperature from the sensor. I have followed the developer articles I could find around CMWaterSubmersionManager and have set up a simple class to interact with it. It is now that I want to run my app and test if it is working as I expect it to etc. However I noticed that the waterSubmersionAvailable is only set to true on physical Apple Watch Ultra and Ultra 2. This is rather inconvenient as it means that for the next week or so while developing this feature I will have to stick my arm wearing the watch into a container of water to test the feature. Just wondering if there is any easier way to debug this stuff that anyone has figured out? It would be ideal if this could just be done in the simulator similar to how other device conditions can be induced. I did notice the "Enable Easy Submersion" option in the Debug menu, however I could not figure out a difference between having this on or off, and could not find any explanation of what it actually does on the docs. Does anyone have any experience with this either? Any advice would be appreciated, and to any Apple engineers who may see this, please please please add an option to be able to debug this stuff in the Simulator
Posted
by devharry.
Last updated
.
Post not yet marked as solved
0 Replies
360 Views
Is there a way to migrate WidgetKit extensions made using dual-target watchOS apps to single-target apps? When you create a widget extension with a dual-target app, the bundle identifier includes the extra extension domain (com.company.app.watchkitapp.watchkitextension.widgets). When Xcode 15 migrates a dual-target to single-target, it removes “.watchkitextension” from both the watchOS app bundle identifier and the widget extension bundle identifier. watchOS seems to handle migrating the main app just fine, but any complications created with the dual-target do not get migrated and are just blank until the user re-configures, which would be a huge bummer to have to ship. If I try to manually set the bundle identifier back to include “.watchkitextension”, the OS rejects the installation because of the extraneous dot after the parent app’s prefix.
Posted
by bbatsell.
Last updated
.
Post not yet marked as solved
1 Replies
302 Views
I am currently developing app that counts the Steps, and for that I am using the pedometer. I am not sure of how frequent pedometer provides updates, in my case it provides update around 3 second. There is nothing mentioned about frequency of Data in Official documentation of Apple or Any ways to set the Frequency. Application is in Both iOS and WatchOS plateform To achieve data i have tried following things: With startUpdates(from: Date) pedometer.startUpdates(from: Date()) { [weak self] pedometerData, error in guard let data = pedometerData, error == nil else { return } DispatchQueue.main.async { self?.stepCount = data.numberOfSteps.intValue } } With queryPedometerData() timer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { [weak self] _ in self?.fetchPedometerData() } private func fetchPedometerData() { pedometer.queryPedometerData(from: Date().addingTimeInterval(-1), to: Date()) { [weak self] pedometerData, error in guard let data = pedometerData, error == nil else { return } DispatchQueue.main.async { self?.stepCount = data.numberOfSteps.intValue } } } I have done this both implementation but Not getting desired results. I want data every second, Could it be possible ? Any help or leads would really helpful Thank You :)
Posted Last updated
.
Post not yet marked as solved
0 Replies
216 Views
Hello, For several months now, my watch app will not automatically install when I install local builds from Xcode. If I download our app from the app store, the watch app automatically installs immediately after the phone app (and automatic app install is set to ON in my Apple Watch Settings). But if I install a build from Xcode, I have to manually install the watch app after installing the phone app. How do I get it to go back to the previous behavior where, after I install the phone app, the watch app just automatically installs? It used to do this automatically for me, but no longer does. I want to say this behavior started when I installed the Xcode beta late last year but the behavior has continued on the newest version of Xcode.
Posted
by bryany.
Last updated
.
Post marked as solved
9 Replies
3.2k Views
Right, this is getting on my nerves now. iOS app installed on iPhone via Xcode. Watch app installed on Watch via Xcode. Both apps are running and are in the foreground. iOS app launches on iPhone and reports: WCSession.isSupported = YES theDelegate.session.isPaired = YES theDelegate.session.watchAppInstalled = NO theDelegate.session.activationState = Activated I press a button in the Watch app. It reports: session == activated and reachable iOS app delegate receives a message from the Watch app: didReceiveMessage (from Watch): message = {     action = giveMeUpdatedItems; } The apps must be installed on the devices in order for the Watch app to have used sendMessage (which is only available if the session is reachable, which it is). iOS app delegate passes that through as a notification to another bit of code that collates the info and sends it back to the Watch app. watchNotificationUpdateData; userInfo = {     action = giveMeUpdatedItems; } That bit of code in the iOS app checks whether we can send data to the Watch app, and doesn't send the data because: WCSession.isSupported = YES theDelegate.session.isPaired = YES theDelegate.session.watchAppInstalled = NO theDelegate.session.activationState = Activated If I remove the check for watchAppInstalled, I get this: Error sending Watch application context: Watch app is not installed. {     NSLocalizedDescription = "Watch app is not installed.";     NSLocalizedRecoverySuggestion = "Install the Watch app."; } I've deleted and reinstalled the app on both devices countless times. I've rebooted the devices, plus the Mac. I've reinstalled Xcode. I've cleaned builds. I've deleted DerivedData. And still it says the companion app isn't installed.
Posted
by darkpaw.
Last updated
.
Post not yet marked as solved
5 Replies
882 Views
I have a Watch companion app. The SwiftUI previews fail to build for the watch app. The errors indicate it is trying to build Swift package targets that are meant for iOS only, not the watch. The watch does not include these dependencies so it is perplexing it will try to build them. Digging into the scheme for the watch app, it includes the iOS target as you can see the screenshot. This seems to be the default when you create a new watch target. If I uncheck the boxes for the iOS target, previews will build fine. But I think this means that each time I build my Watch target, it will not simultaneously build my iOS target. I'm not sure of the impact of that. Is this a known limitation with Previews? Is there another workaround?
Posted Last updated
.