Build issue when creating an Apple Watch standalone app archive
This is an Apple Watch standalone app. (Without an iPhone app)
Even if you create an Apple Watch standalone app as a new project in Xcode, two targets are created: "iPhone target + Apple Watch target".
The iPhone target cannot be built or modified.
Usually, builds or archives are created with the Apple Watch target.
It's been a while since I updated the app, so I tried to fix it, add new features, and update it.
When I created an archive, the version kept being created as 1.0 - 1.
I entered 1.1 - 8 for the Apple Watch target.
In the previous Xcode version, when I clearly modified the version and build version of the Apple Watch target, it was reflected in the archive file.
However, in the current Xcode, it is not reflected.
Does anyone know how we can fix this issue?
WatchKit
RSS for tagBuild apps that leverage watchOS features like background tasks, extended runtime sessions, and access to the Digital Crown using WatchKit.
Posts under WatchKit tag
131 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Hi everyone,
I have a question regarding the integration of Apple Watch and Vision Pro. Is it possible to connect an Apple Watch to Vision Pro to access health data and display it within Vision Pro applications? If so, could you provide some guidance or point me towards relevant resources or APIs that would help in achieving this?
Thank you in advance for your assistance!
Hi! I'm working on an app that records x,y,z accelerometer values and when subjecting the watch to extreme acceleration (a swing) I notice the x, and y acceleration seems to get stuck around ~30G.
Is this a hardware limitation of the watch sensors? I have a Apple Watch Series 7.
Below is the chart of the acceleration recording session.
Appreciate your insights!
Joao
I have a Companion Watch App for my iPhone App and communicate via the messages and applicationContext between the watch and the phone. If I start an Event at my iPhone and my watch is turned on the extendedRuntimeSession starts as it should. But as soon as my Watches Display is off or Im not in the App I can't start the extendedRuntimeSession, even though I receive it trough the applicationContext and I get the following errorMessage when trying to start the session in the background.
-[CSLSSessionService startSession:completionWithExpirationDate:]_block_invoke session A76273B7-3E01-4333-920C-0614C1FAC5B0 encountered error Error Domain=com.apple.CarouselServices.SessionErrorDomain Code=12 "app not in required app state" UserInfo={NSLocalizedDescription=app not in required app state}
Is Running is true
Timer started/continuend
-[SPApplicationDelegate appBeginWorkout:]_block_invoke:1334: Asked to start a workout, but WKExtensionDelegate <SwiftUI.ExtensionDelegate: 0x15d7c500> doesn't implement handleWorkoutConfiguration:
Extended runtime session invalidated with reason: WKExtendedRuntimeSessionInvalidationReason(rawValue: -1), error: Optional(Error Domain=WKExtendedRuntimeSessionErrorDomain Code=3 "The app must be active and before applicationWillResignActive to start or schedule a WKExtendedRuntimeSession." UserInfo={NSLocalizedDescription=The app must be active and before applicationWillResignActive to start or schedule a WKExtendedRuntimeSession..})
I control and manage my session like this:
class WatchViewModel: NSObject, ObservableObject {
static let shared = WatchViewModel()
var session: WCSession
var extendedRuntimeSessionManager: ExtendedRuntimeSessionManager
var lastMessage: [String: Any] = ["method": "none"]
@Published var iOSIsReachable = false
@Published var dataFromMessages = DataFromMessages()
@Published var flextailCoordinates: FlextailCoordinates?
init(session: WCSession = .default, extendedRuntimeSessionManager: ExtendedRuntimeSessionManager = ExtendedRuntimeSessionManager()) {
NSLog("init start")
self.session = session
self.extendedRuntimeSessionManager = extendedRuntimeSessionManager
super.init()
self.session.delegate = self
session.activate()
NSLog("init done")
}
}
class ExtendedRuntimeSessionManager: NSObject, WKExtendedRuntimeSessionDelegate, ObservableObject{
var extendedRuntimeSession: WKExtendedRuntimeSession?
@Published var sessionIsActive = false
override init() {
super.init()
setupExtendedRuntimeSession()
}
func setupExtendedRuntimeSession() {
extendedRuntimeSession = WKExtendedRuntimeSession()
extendedRuntimeSession?.delegate = self
}
func startExtendedRuntimeSession() {
if sessionIsActive == false{
extendedRuntimeSession?.start()
} else{
print("Already running extendedRuntimeSession")
}
}
func stopExtendedRuntimeSession() {
extendedRuntimeSession?.invalidate()
sessionIsActive = false
setupExtendedRuntimeSession()
}
// WKExtendedRuntimeSessionDelegate methods
func extendedRuntimeSessionDidStart(_ extendedRuntimeSession: WKExtendedRuntimeSession) {
print("Extended runtime session started")
sessionIsActive = true
}
func extendedRuntimeSessionWillExpire(_ extendedRuntimeSession: WKExtendedRuntimeSession) {
print("Extended runtime session will expire soon")
}
func extendedRuntimeSession(_ extendedRuntimeSession: WKExtendedRuntimeSession, didInvalidateWith reason: WKExtendedRuntimeSessionInvalidationReason, error: Error?) {
print("Extended runtime session invalidated with reason: \(reason), error: \(String(describing: error))")
sessionIsActive = false
setupExtendedRuntimeSession()
}
}
I tried sending it through the applicationContext but that didn't work, even though the message gets received and parsed as I want. The error specifically seems to be in the starting of an extendedRuntimeSession in the background.
Hi,
We developed a app for iPhone and Apple Watch. The app has been tested and it worked well on iPhone SE and Apple Watch Series 6 running earlier OS. We recently upgraded the Apple Watches to Series 9 & watchOS 10.5, and the iOS on the same iPhone is upgraded to 17.4.1. The app can still be built on the iPhone but when I tried to install the app on the new Apple Watch, it won't work and shows "This app cannot be installed because its integrity could not be verified." To make sure it's not a OS issue, I also upgraded the watchOS on the old Apple Watch Series 6 to 10.5 and the app worked. I wonder what cause the app fail on the newer Apple Watch running the same watchOS.
Thank you
My project has an iOS and WatchOS app. I added a package dependency, which supports both iOS and WatchOS, though I have only added the library to my iOS app.
I can compile and run both apps just fine but when I try to use one of the WatchOS app views in Canvas preview I get errors saying different properties defined in the packages files are not available on watchOS.
These blocks of code that give errors are wrapped in: "if TARGET_OS_IPHONE". I have selected the Watch Target and a watch device in the run selector as well as in the canvas.
Why is this failing and how can I get it working? Thanks
Now my main app is already invoked voip callkit, I would want to invoke voip on iWatch app, but I have some issue:
1、How to deal audio data and network connect of iWatch voip ? can we depends on iPhone app?
2、How to use voip callkit on iWatch that only via bluetooth connect ?
3、If main app is already support voip callkit, how to support callkit for iwatch? Do we need to repeat and independently implement callkit, network, and audio on iWatch?
4、how to add support dial number on iWatch use by the thirdpart app? the case is the same with on the iPhone use, user can send dial by system call record .
Any help is appreciated, thanks in advance.
Today I installed Xcode 16 Beta 3. I have the watchOS 11 simulator installed on my Mac. When building my watch app with Xcode Beta 3 I am getting the following error.
/Applications/Xcode-16-beta-3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Library/Application Support/MessagesApplicationStub/MessagesApplicationStub.xcassets: No simulator runtime version from [<DVTBuildVersion 21F79>] available to use with iphonesimulator SDK version <DVTBuildVersion 22A5307d>
I have no idea what those assets are for but they aren't part of my project.
I tried generating a new standalone watch app project using Xcode 16 Beta 3 and I am getting the same error message so this isn't something particular to my original watch project.
Any help on how to fix this issue is appreciated.
Hello,
I am developing an application for the Apple Watch that requires the screen to remain active even when the wrist is moved into a down position. The core functionality of my app involves providing continuous visual and auditory guidance, and it's critical that the screen stays on without going into power-saving mode while the app is in use.
Specifically, I am looking for a way to:
1.Disable the screen's power-saving mode when the wrist is moved down.
2.Ensure the screen remains active as long as the app is in the foreground.
I understand that certain power management features are built into watchOS for battery conservation, but I would need this behavior to be overridden only while the application is running (the app would not be in the foreground for extended periods of time).
Is there an approved method or best practice within Apple's guidelines to achieve either of these functionalities?
Thank you for your assistance.
Hello,
I am developing an application for the Apple Watch that requires the screen to remain active even when the wrist is moved into a down position. The core functionality of my app involves providing continuous visual and auditory guidance, and it's critical that the screen stays on without going into power-saving mode while the app is in use.
Specifically, I am looking for a way to:
1.Disable the screen's power-saving mode when the wrist is moved down.
2.Ensure the screen remains active as long as the app is in the foreground.
I understand that certain power management features are built into watchOS for battery conservation, but I would need this behavior to be overridden only while the application is running (the app would not be in the foreground for extended periods of time).
Is there an approved method or best practice within Apple's guidelines to achieve either of these functionalities?
Thank you for your assistance.
So for context I am building an app where the Apple Watch establishes a WatchConnectivity session with the parent iPhone app and streams audio data from the watch Mic to the iPhone for processing on Deepgram to perform STT.
This works very well, unless I tilt my wrist and the display goes to sleep. What I find strange is that due to the mic being in use on my watch, the app is still showing on the always on display and is still trying to send the audio data to my phone in the background (which is perfect!) but the iPhone does not seem to be responding.
So my watch code is:
private func sendData(_ data: Data) {
let dict: [String: Any] = ["audioData": data]
session.sendMessage(dict, replyHandler: nil, errorHandler: { error in
print("Failed to send data: \(error.localizedDescription)")
})
}
and my Xcode logs Failed to send data: WatchConnectivity session on paired device is not reachable.
So the watch is still running the process but because session.isReachable is false the audio data is not sent which it should be!
Is there any way to keep the connection established and data sharing when the display dims?
Hello, fellow developers! How would you approach .watchface file to extract it's metadata? I need to know in which version of the app the face was created, to prompt the user to update the app if necessary.
Looking at binary I suppose that a .watchface file consists of a PNG previews and JSON metadata and it all packed in one file somehow. Probably archived with gzip.
I have an iOS app, with a watch counterpart, used to enter scores for a match. The watch app starts a match (and a workout session) when it receives a notification from the mobile app, after the user started a match on their phone. Basically the watch app is just a more convenient way of inputing scores, so the user wouldn't have to reach for and unlock their phone every time - therefore the need for the watch app to always be displayed.
The flow follows these steps:
the user is prompted for workout session access when first launching the app;
after they accept, I start the workout;
the delegate method workoutSession(didChangeTo) returns the expected values;
the app remains active, even when the user lowers their wrist;
when I go to the clock, the app's icon is displayed in a circle at the top (bringing the app back to foreground on tap).
The only problem is that the "Return to app" option in the "Return to Clock" settings menu is missing, what do I need to do in order to display it?
Here's an example of what it looks like for the Strava app:
and how it looks for mine.
When I initiate WKExtendedRuntimeSession with a background mode of "Underwater Depth" I get an orange indicator showing the Action button on the screen that stays showing all the time and then animates when you press the action button. I believe this started with a recent WatchOS update, because it never happened before.
Does anyone know how to hide it? Or keep it and be able to detect the Action button presses within my app (if possible)?
Hi All, can anyone help me to the below issue? i used the WatchConnectivity to send data from iphone to watch app. Now i tried to run them on emulator (watch series 5, and iphone 15 pro)
I have an error when i tried to send message data from iphone app (react-native) to watch app:
{
"code": "EWCERRORDOMAIN7014",
"domain": "WCErrorDomain",
"message": "Payload could not be delivered.",
"nativeStackIOS": [
"0 releasev2 0x0000000101979c90 RCTJSErrorFromCodeMessageAndNSError + 112",
"1 releasev2 0x0000000101979bd0 RCTJSErrorFromNSError + 256",
"2 releasev2 0x000000010190c2b4 __41-[RCTModuleMethod processMethodSignature]_block_invoke_4.110 + 148",
"3 releasev2 0x000000010185003d __35-[RNWatch sendMessage:reply:error:]_block_invoke.116 + 77",
"4 WatchConnectivity 0x000000011428b176 __70-[WCSession _onqueue_notifyOfMessageError:messageID:withErrorHandler:]_block_invoke + 206",
"5 Foundation 0x0000000119095004 NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK + 7",
"6 Foundation 0x0000000119094f02 -[NSBlockOperation main] + 94",
"7 Foundation 0x0000000119097ef2 NSOPERATION_IS_INVOKING_MAIN + 17",
"8 Foundation 0x00000001190940aa -[NSOperation start] + 730",
"9 Foundation 0x0000000119098744 NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION + 17",
"10 Foundation 0x0000000119098385 __NSOQSchedule_f + 182",
"11 libdispatch.dylib 0x000000011434ca90 _dispatch_call_block_and_release + 12",
"12 libdispatch.dylib 0x000000011434dd3a _dispatch_client_callout + 8",
"13 libdispatch.dylib 0x000000011435126a _dispatch_continuation_pop + 874",
"14 libdispatch.dylib 0x00000001143502b0 _dispatch_async_redirect_invoke + 994",
"15 libdispatch.dylib 0x000000011436041e _dispatch_root_queue_drain + 372",
"16 libdispatch.dylib 0x0000000114360e88 _dispatch_worker_thread2 + 244",
"17 libsystem_pthread.dylib 0x0000000116800c0f _pthread_wqthread + 257",
"18 libsystem_pthread.dylib 0x00000001167ffbbf start_wqthread + 15"
],
"userInfo": {
"NSLocalizedDescription": "Payload could not be delivered."
}
}
Here is the class connector shared data on watch target:
class SharedDataConnecter: NSObject, ObservableObject {
var session: WCSession
init(session: WCSession = .default){
self.session = session
super.init()
if WCSession.isSupported(){
session.delegate = self
session.activate()
}
}
}
extension SharedDataConnecter: WCSessionDelegate{
func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) {
print("Active State: ", activationState.rawValue)
print("Error: ", error)
}
func session(_ session: WCSession, didReceiveMessage message: [String : Any], replyHandler: @escaping ([String : Any]) -> Void) {
print("AAAA message from app: ", message)
}
}
I would be great if the watchOS can adopt some of the new App Intents for the Action Button on iOS.
On Apple Watch Ultra this is still limited on workout related Intents (However system apps like flash light can do more).
See als this FB:
FB11699104 (opened in 2022)
Best regards
Arno
Hello,
As per Apple Documentation Link for CoreMotion framework we can read high frequency heart rate using CMHighFrequencyHeartRateData but there is No way to set the type like heartRate and have a updateHandler to provide the heart rate data. But for Accelerometer data, CoreMotion framework can provide startAccelerometerUpdates(to:, withHandler:) and user can set update interval like accelerometerUpdateInterval using CMMotionManager.
But There is no solution available for heartRate. If any solution is available to read heartRate using CMHighFrequencyHeartRateData it will be helpful for me.
I know we can read the Heart Rate Data using HealthKit framework using HKAnchoredObjectQuery but the heart rate data is not consistent and startDate & endDate for heart rate data is also not consistent. We want heart rate very frequent like every second.
Any help can be appreciated. Thanks in advance
I'm developing a single target watchOS app that obtains HealthKit information. I have the "Background Delivery" option checked under "Signing & Capabilities" for the watch target. The app does HKObserverQueries in the foreground that work as I would expect. But when I click the Digital Crown to return to clock face, the HKObserverQuery activity stops. I'm using Xcode 15.4, on Mac 14.5 and a Apple Watch Series 4 running 10.5.
I have an iPhone app, and added watch support, including a simple launcher complication. I can add the complication using the edit UI on the watch, but the complication is not visible using the watch app on the iPhone.
When I add my complication on the watch and then open the watch app on the iPhone, the complication slot shows as "Off".
What could I be doing wrong?
I have a sports iOS app with a paired watch app, that uses location to update some UI elements. I technically need the location only when the watch app is in foreground, but since another requirement is to stop the clock from replacing the app, I decided to add background location checks. I followed the steps from the documentation (adding Background Modes to the watch extension target, setting allowsBackgroundLocationUpdates to true):
the location update works fine
when I go to the clock, the app's icon is displayed in a circle at the top (bringing the app back to foreground on tap).
The only problem is that the "Return to app" option in the "Return to Clock" settings menu is missing, what do I need to do in order to display it?
Here's an example of what it looks like for the Strava app:
and how it looks for mine.