Hello,
We are using NearbyInteraction to get the distance between an iPhone and Apple Watch. Overall it works pretty well, but we are noticing that it sometimes produces duplicate (or near duplicate) timestamps. Here is an example of the data produced (time is in seconds since scan start):
0: 1.882862
1: 1.88296
2: 1.981459
3: 1.981495
4: 2.080235
5: 2.080397
As you can see there's a pattern where two updates have very similar timestamps. This seems to only happen when using 2 U2 chips together. Is this an expected behavior? If so, why?
The timestamps are calculated using:
let bootTimeInterval = bootTime()
func bootTime() -> TimeInterval {
let uptime = ProcessInfo.processInfo.systemUptime
let nowTimeIntervalSince1970 = Date().timeIntervalSince1970
return nowTimeIntervalSince1970 - uptime
}
// Then later on each NISession update...
let timestamp = bootTimeInterval + ProcessInfo.processInfo.systemUptime
The app produces unix timestamps but I have converted them to be relative to the start of the scan to be easier to read.
Note that bootTimeInterval is calculated once at the start of the app, so all timestamps produced on a UWB update should be using the same clock.
Things I've confirmed:
The NISession is only able to connect to one device, so it is not coming from a different device.
Any feedback is appreciated, thank you.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi, as stated in the title I'm trying to launch a watchOS app from its companion iOS app.
My issue is very similar to this post: https://developer.apple.com/forums/thread/734362
The response from apple in that post says that it is not possible, but I have found it to be possible for media apps. Specifically if you turn Settings > General > Auto-Launch > Live Activities > Media Apps and turn Auto-Launch to "App".
My app is for medical research and having this available would be very helpful for our testing. I need the app to be fully in the foreground. Is there a way to get specific permissions for our app to do this? Am I missing something?
I've tried starting a workout session to accomplish this, but it only seems to work when the watch is charging.
Any feedback is appreciated, thank you.
Hello, I am making an app that requires the use of builtInTrueDepthCamera. I am trying to set a custom exposure mode but the completion for:
open func setExposureModeCustom(duration: CMTime, iso ISO: Float) async -> CMTime
never gets called.
It works perfectly fine for builtInLiDARDepthCamera. In my function I am confirming that a custom exposure mode is supported and it is within the range of acceptable durations. Is it known that this just does not work?
Here is my AVCaptureDevice extension function:
extension AVCaptureDevice {
func setExposureTime(to milliseconds: Double) async {
print("setting exposure time 1")
await withCheckedContinuation { continuation in
// Check if custom exposure mode is supported
guard self.isExposureModeSupported(.custom) else {
print("Custom exposure mode is not supported on this device.")
continuation.resume() // Resume immediately if not supported
return
}
// Convert milliseconds to CMTime
let exposureTime = CMTimeMake(value: Int64(milliseconds * 1_000), timescale: 1_000_000)
print("Exposure time var : \(exposureTime.seconds * 1000)")
print("Exposure time min : \(self.activeFormat.minExposureDuration.seconds * 1000)")
print("Exposure time max : \(self.activeFormat.maxExposureDuration.seconds * 1000)")
// Ensure the exposure time is within the supported range
guard exposureTime >= self.activeFormat.minExposureDuration,
exposureTime <= self.activeFormat.maxExposureDuration else {
print("Exposure time is out of the supported range.")
continuation.resume() // Resume immediately if out of range
return
}
print("setting exposure time 2")
// Attempt to set the exposure time
do {
try self.lockForConfiguration()
print("setting exposure time 3")
self.setExposureModeCustom(duration: exposureTime, iso: AVCaptureDevice.currentISO) { time in
print("Exposure time set to: \(time.seconds * 1000) ms")
continuation.resume() // Resume after the completion handler is executed
}
self.unlockForConfiguration()
} catch {
print("Failed to configure exposure: \(error)")
continuation.resume() // Resume on failure
}
}
}
}
Topic:
App & System Services
SubTopic:
Hardware