Post not yet marked as solved
So I recently tried to update my watch. I have an iPhone X iOS 14 and a series 3 watch without cellular. At first it couldn’t download because it didn’t have enough space. I don’t have many apps if any on my watch, so I tried restarting it because I read in another help guide to do that. After I did that, the watch reverted to factory setting and there was no way for me to download the new update because I’m not “connected to the internet” despite having great service and WiFi. The app doesn’t let me use the watch without updating it of course, so now my beloved watch is now an expensive paper weight. Other websites load on my phone so the internet isn’t the problem. I’ve tried resetting everything and resetting the network settings and turning off cellular for the watch app and I can’t access anything on the watch and can’t access settings on the watch app because it only tells me to pair a watch. Please please help.
Post not yet marked as solved
I have an overall Form which contains, among other cells, a picker, e.g.:
Form {
	 SomeCell()
	 SomeCell()
	 Picker(...)
}
The Picker isn't even initially on-screen - it's further down in the scroll view. But when the user first enters the screen, the picker has focus - the Digital Crown starts scrolling the picker. Then if the user uses their finger to scroll, the Digital Crown transfers focus to the overall Form scrolling, and I can't get the picker to regain focus for the Digital Crown at all anymore.
How can I tell the system that the Digital Crown should initially focus on scrolling the Form and not the Picker, and to allow tapping on the Picker to give it focus for the Digital Crown? (i.e. the expected user experience.) This was one area which WatchKit seemed to handle better than SwiftUI does.
For the record, I tried playing around a bit with focusable(), prefersDefaultFocus(in:), and focusScope() and declared a single namespace for the entire screen, but it didn't seem to help. I'm not sure if the Form object itself can really respond to focusable() anyhow.
Post not yet marked as solved
I have implemented a very simple iOS + WatchOS app project, where I test how one can communicate with the other. I will paste the code below, but the idea is really simple. Each app has one single screen with a button and a label. Tapping the button will send a message to the counterpart indicating the timestamp when the message was generated.
If I run the app on the simulators, everything works fine: messages are sent and received correctly on both the iPhone and the Watch. (You can find a reference gif on imgur.com/ + o1ZQTLp).
The problem occurs when I try to run the same apps on my physical devices. Session is activated successfully but messages aren't sent. If I debug the code, I even see the WCSession.isReachable value set to true.
When debugging the WatchKit app, I see errorHandler is called on the func sendMessage(), and the error states:
WatchConnectivity session on paired device is not reachable. However, the errorHandler isn't called from the iPhone app.
Details of my devices:
iOS version: 14.0.1
WatchOS version: 7.0.1
I tested this same code before installing the 7.0.1 WatchOS and it worked without any problems, so I wonder if the update introduced some error on the WatchConnectivity framework.
Code on the iPhone app:
import UIKit
import WatchConnectivity
class ViewController: UIViewController {
		@IBOutlet weak var messageLabel: UILabel!
		fileprivate var wcSession: WCSession!
		override func viewDidLoad() {
				super.viewDidLoad()
				wcSession = WCSession.default
				wcSession.delegate = self
				wcSession.activate()
		}
		@IBAction func sendMessageAction(_ sender: Any) {
				let message = [
						"content": "Message sent from iPhone on \(Date())."
				]
				wcSession.sendMessage(message, replyHandler: nil, errorHandler: { error in
						print("Error when sending message: \(error.localizedDescription)")
				})
		}
}
extension ViewController: WCSessionDelegate {
		func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) {
				switch activationState {
				case .activated:
						print("WCSession activated successfully")
				case .inactive:
						print("Unable to activate the WCSession. Error: \(error?.localizedDescription ?? "--")")
				case .notActivated:
						print("Unexpected .notActivated state received after trying to activate the WCSession")
				@unknown default:
						print("Unexpected state received after trying to activate the WCSession")
				}
		}
		func session(_ session: WCSession, didReceiveMessage message: [String : Any]) {
				guard let content = message["content"] as? String else { return }
				DispatchQueue.main.async {
						self.messageLabel.text = content
				}
		}
		func sessionDidBecomeInactive(_ session: WCSession) {
		}
		func sessionDidDeactivate(_ session: WCSession) {
		}
}
Code on the Watch Kit app:
import WatchKit
import Foundation
import WatchConnectivity
class InterfaceController: WKInterfaceController {
		@IBOutlet weak var messageLabel: WKInterfaceLabel!
		fileprivate var wcSession: WCSession!
		override func awake(withContext context: Any?) {
				wcSession = WCSession.default
				wcSession.delegate = self
				wcSession.activate()
		}
		@IBAction func sendMessageAction() {
				let message = [
						"content": "Message sent from Watch on \(Date())."
				]
				wcSession.sendMessage(message, replyHandler: nil, errorHandler: { error in
						print("Error when sending message: \(error.localizedDescription)")
				})
		}
}
extension InterfaceController: WCSessionDelegate {
		func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) {
				switch activationState {
				case .activated:
						print("WCSession activated successfully")
				case .inactive:
						print("Unable to activate the WCSession. Error: \(error?.localizedDescription ?? "--")")
				case .notActivated:
						print("Unexpected .notActivated state received after trying to activate the WCSession")
				@unknown default:
						print("Unexpected state received after trying to activate the WCSession")
				}
		}
		func session(_ session: WCSession, didReceiveMessage message: [String: Any]) {
				guard let content = message["content"] as? String else { return }
				messageLabel.setText(content)
		}
}
Post not yet marked as solved
Dear Community / Apple,
I would like to ask in the name of many Smart Home Community,
There is any developing / There is any future plan about make Apple Watches able to read NFC Tags / Stickers?
Many of us would like to use Apple Watch to use Home Automations with NFC Stickers, but we have to use our iPhone instead of the Watch, what would be the most logical way to use these things.
We does not really understand why this was not added by default, and why we cannot find any official information about this?
Please provide us some answer, at least we should know should we still wait for this feature or this is not gonna be enabled by Apple?!
Thank you very much,
Gery
Post not yet marked as solved
I've been using CloudKit for my app recently and I'm trying to add support for a WatchOS app and I've enabled iCloud in capabilities and ticked the container I want to use but I get this error.
CoreData: error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate recoverFromPartialError:forStore:inMonitor:]block_invoke(1943): <NSCloudKitMirroringDelegate: 0x282430000>: Found unknown error as part of a partial failure: <CKError 0x28112d500: "Permission Failure" (10/2007); server message = "Invalid bundle ID for container"; uuid = ; container ID = "iCloud.Appname">
I tried creating a new container which worked for both the watch app and iOS app however I would like to use my original container since it has my old data
Post not yet marked as solved
I'm trying to have a navigation link that is triggered programatically. If I use the following code, on iOS, then the second NavigationLink is not put into the UI, as expected. On watchOS, however, there's a visible button with no text.
How can I accomplish this on watchOS?
var body: some View {
NavigationView {
VStack {
NavigationLink("No login required", destination: UnprotectedView())
NavigationLink(destination: ProtectedView(), isActive: $isActive) {
EmptyView()
}
Button("Login required", action: pushIfAuthenticated)
}
.navigationBarTitle("Choose")
}
}
I am pretty new to Swift development and I am currently developing my first project where I calculate the stress level of a person using the Heart Rate Variability samples from HealthKit. I finished the iOS app where I request all HRV samples from the past 120 days, this works perfectly. But when I try to do the same in my Apple Watch project, I am only able to retrieve data from the past 8 days. This seems weird to me, since the data is recorded on the Apple Watch itself and HealthKit has a shared database.
I am wondering if HealthKit just limits the predicates to 8 days for HR data on the Apple Watch or if this might be a problem with my Apple Watch?
Thanks in advance.
Post not yet marked as solved
Is it possible to let the apple watch vibrate with no sounds?
Post not yet marked as solved
When I run my watchOS app on a real device, It prints this in the console:
watchOS Extension[313:21609] [BTAudioSession] Activate failed: kParamErr (### BTSmartRoutingDaemon not running)
watchOS Extension[313:21609] [BTAudioSession] Error: kParamErr (### BTSmartRoutingDaemon not running)
What is this BTAudioSession and BTSmartRoutingDaemon? There's nothing available with this name on Apple Developer Documentation neither somewhere on the internet.
Note: I am not using any third party frameworks.
Post not yet marked as solved
I am unable to install my watch app on my Apple Watch via Xcode. There is no code change from my end and this issue just happened recently. My Apple Watch is running on watchOS 7.3. This is the error log I received whenever I tried to build my watchOS app.
Details
Unable to install "xxxxx Watch App"
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402652944-
The version of WatchKit used by this app is no longer supported on this version of watchOS.
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402652944
User Info: {
		DVTRadarComponentKey = 261622;
		MobileDeviceErrorCode = "(0xE80000F0)";
		"com.apple.dtdevicekit.stacktrace" = (
0	 DTDeviceKitBase										 0x000000012e633c8f DTDKCreateNSErrorFromAMDErrorCode + 220
1	 DTDeviceKitBase										 0x000000012e672241 __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 155
2	 DVTFoundation											 0x000000010b53e64b DVTInvokeWithStrongOwnership + 71
3	 DTDeviceKitBase										 0x000000012e671f82 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1440
4	 IDEiOSSupportCore									 0x000000012e4e2a10 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.292 + 3513
5	 DVTFoundation											 0x000000010b66d17e DVT_CALLING_CLIENT_BLOCK + 7
6	 DVTFoundation											 0x000000010b66eda0 __DVTDispatchAsync_block_invoke + 1191
7	 libdispatch.dylib									 0x00007fff2018b5dd _dispatch_call_block_and_release + 12
8	 libdispatch.dylib									 0x00007fff2018c7c7 _dispatch_client_callout + 8
9	 libdispatch.dylib									 0x00007fff201925fe _dispatch_lane_serial_drain + 606
10	libdispatch.dylib									 0x00007fff201930cb _dispatch_lane_invoke + 375
11	libdispatch.dylib									 0x00007fff2019cc5d _dispatch_workloop_worker_thread + 819
12	libsystem_pthread.dylib						 0x00007fff20334499 _pthread_wqthread + 314
13	libsystem_pthread.dylib						 0x00007fff20333467 start_wqthread + 15
);
}-
System Information
macOS Version 11.2 (Build 20D64)
Xcode 12.4 (17801) (Build 12D4e)
Timestamp: 2021-02-04T00:36:31+08:00
Things I have tried: Upgrading/downgrading Xcode (version 12.2, 12.3, 12.4 and 12.5 beta)
Deleting "Derived Data" folders
Unpairing/Pairing my Apple Watch
Cleaning the project and restarting XCode
Any help would be greatly appreciated. Thank you!
Post not yet marked as solved
I updated the Apple Watch 3 to the latest os and now I am not able to run my independent watchos app on it.
See as it happens with every release they forget to put the symbols file.
https://developer.apple.com/forums/thread/664613
https://developer.apple.com/forums/thread/656601
https://developer.apple.com/forums/thread/663557
Is there anyone else also facing this work? Also, what's the workaround. I saw that if you have symbols for previous versions you can tweak it or something but I don't have anything as this would be the first time I would be running the watchos app.
Any other advice where I can reach out to?
Post not yet marked as solved
Greetings fellow WatchOS app developers,
On the iOS simulator running 12.5 beta, the method updateApplicationContext() claims that it succeeded, no exception is thrown and yet the WatchOS app, running on a WatchOS 7.4 simulator never gets its
language
session(_ session: WCSession, didReceiveApplicationContext applicationContext: [String : Any]) method invoked.
Same issue in the other direction: The WatchOs app claims success on updating the iPhone app's application context. Yet nothing arrives.
This works fine on real devices running iOS 14.5 beta and WatchOS 7.4 beta.
Are there any workarounds? Due to Covid-19, I'm working remotely and can't debug on a real device, and need to be able to debug a critical WatchOS 7.4 specific issue.
Thanks in advance!
Post not yet marked as solved
Hi everybody,
Thanks for review my ask. I'm developing an app for WatchOS. I want to detect a magnetic field near to iWatch but when ask to isMagnetometerAvailable always response false.
In iOS I've been able to detect a magnetic field save data from this to analyse.
My iWatch has the compass and I thought that it was possible to detect a magnetic field like this app.
Is possible in WatchOS detect a magnetic field with magnetometer?
Post not yet marked as solved
I am developing an watchOS app the need to continuously send current Heart Rate to server. To run the app continuously in background I have to start HKWorkoutSession but this open our app each even I kill the app. How can I do it correctly.
Post not yet marked as solved
Hello everyone.
I'm trying to work with Core Motion, getting readings from my Apple Watch (Series 4), but am getting inconsistent behaviour.
If I run the code from Apple's Core Motion documentation - https://developer.apple.com/documentation/coremotion/getting_processed_device-motion_data (see Listing 1), I don't get any readings.
The code I run, which works fine on iPhone, but not on Apple Watch, is:
func startDeviceMotion() {
if motion.isDeviceMotionAvailable {
self.motion.deviceMotionUpdateInterval = 1.0 / 60.0
self.motion.showsDeviceMovementDisplay = true
self.motion.startDeviceMotionUpdates(using: .xMagneticNorthZVertical)
self.timer = Timer(fire: Date(), interval: (1.0 / 60.0), repeats: true, block: { (timer) in
if let data = self.motion.deviceMotion {
let x = data.attitude.pitch
let y = data.attitude.roll
let z = data.attitude.yaw
}
})
RunLoop.current.add(self.timer!, forMode: RunLoop.Mode.default)
}
}
The problem is that although .isDeviceMotionAvailable returns true and runs the if statement correctly, the returned data from self.motion.deviceMotion only gives me nil's.
I.e. DeviceMotion is available but still returns nil.
What I have tried so far without luck, is: Adding various Accelerometer, Gyroscope, Location, and Privacy entries to my Info.plist
Modifying the code: lowered the update interval checking for returned errors from the closure running it on a different thread
Searched online for example projects, StackOverflow, etc., but without luck
Run the code as an iPhone app. Here it works as expected without issues.
I'm fairly new to this forum and Apple Development, so any help would be much appreciated!
Post not yet marked as solved
Hi guys!
I found a bug on Apple Watch that could be performed on any watch devices. but I don’t know where to write it. When I communicated with official store they said that they don’t provide this information further.
So, if you switch time on your iPhone a day forward and then go back to normal time, you will see a collapse with columns in Activity kit. Everything else will be fine, so those columns are not corrected and new activity will not be tracking, including new trainings, warm-ups and so on. If you will go for a training than, you will see 0 calories despite your pulse.
I have a video and photos of this bug if you need it.
Thank you.
Post not yet marked as solved
Is there anybody knowing if there is solution to put watchOS is single app mode? Seems like its possible for all devices except Apple Watches at the moment? Would be super useful to have any kind of info here. Thanks
Post not yet marked as solved
I am trying to figure out how to hide the primaryAction ToolbarItem under the navigation bar in a watchOS app written in SwiftUI. I feel like I've followed the documentation but the toolbar item displays without scrolling the view. What is the correct way to show a discoverable toolbar item when the user scrolls up?
Apple's documentation states
In watchOS the system places the primary action beneath the navigation bar; the user reveals the action by scrolling.
Toolbar Placement - primaryAction - https://developer.apple.com/documentation/swiftui/toolbaritemplacement/primaryaction
Here is the view that I am using: }
The primary action button always displays and is never hidden. I have seen an example where one used a ScrollViewReader to programmatically change the position but I feel like that isn't what Apple has stated is possible and I'm trying to understand what I'm doing wrong. Apple's documentation also states that the toolbar needs to be inside the scrollview:
Place a toolbar button only in a scrolling view. People frequently scroll to the top of a scrolling view, so discovering a toolbar button is almost automatic. Placing a toolbar button in a nonscrolling view makes it permanently visible, eliminating the advantage of hiding it when it’s not needed.
Toolbar Buttons watchOS - https://developer.apple.com/design/human-interface-guidelines/watchos/elements/toolbar-buttons/
Post not yet marked as solved
Hello,
I was trying out the XCUI testing for watch OS with the new Xcode 12.5. However, I could not find any way to swipe left or right on a SwiftUI TabView. I tried swipeLeft() directly on the XCUIApplication, on the windows, on the TabView, but couldn't make it work. I also tried with the .fast option, but no difference.
My question is, is the swiping supported for watchOs on XCUI Test yet?
Thanks!
Post not yet marked as solved
Hello all -
I have built my first watchOS stand-alone app. It tracks moments of motionlessness and if the (adjustable) threshold is not reached in 15, 30 and 45 seconds it triggers an event a, b, c. I am building a string that records the seconds elapsed and the event. May be 100 lines max.
Is there a SIMPLE way to text, email, send, share this string from watchOS w/out building out an entire Eco-system that relies on the paired phone?
I saw a tutorial about writing to icloudDrive, but after a day of returning a nil URL I read: Turns out watchOS does not support iCloud Drive at all, nor does it support the key-value storage iCloud service.
Seriously, if I can just text it to myself I'd be happy.
Note: This is only for proof-of-concept programming - this will never be in production - so hacks are welcome!
Best,
Dan