Post not yet marked as solved
Privacy and Security Settings on Apple Watch requires a screen time passcode, but when I enter the correct passcode, it says its wrong. I need to get into these settings to access developer mode on my watch. If you know how to fix this, please help.
Post not yet marked as solved
I updated Watch OS 10.5 (21T5571a) on May 1. However, the battery is draining quickly. My watch is an Ultra, and I fully charged it at 1 am. When I woke up at 8 am, the battery was at 79%. By 2:30 pm, the battery was only at 20%. I have not engaged in any activities today.
Post not yet marked as solved
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?
Post not yet marked as solved
Hello, everyone,
I have a problem I'm stuck with and have been trying to solve without success for the past 2 weeks.
I am developing a SwiftUI application for Apple Watch which for now I am only running on the simulator. This application has to play sounds but unfortunately so far without success for Apple Watch simulator.
When I tap the button on the application running on the Series 9 (45mm) simulator with watchOS 10.2. I cannot hear any sounds on my MacBook Pro. This happens for all Apple Watch simulators I have in my MacBook.
The same exact code works on the iPhone 15 simulator with iOS 17.2 and I hear the file 1.mp3 from MacBook Pro speakers and also from bluetooth hearphones, if I connect them.
The code is this
import SwiftUI
import AVFoundation
struct ContentView: View {
@State var audioPlayer:AVPlayer?
@State var isPlaying : Bool = false
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
Button("Play"){
if let path = Bundle.main.path(forResource: "1", ofType: "mp3") {
let fileUrl = URL(fileURLWithPath: path)
do{
try AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playback)
try AVAudioSession.sharedInstance().setActive(true)
audioPlayer = AVPlayer(url: fileUrl)
guard let audioPlayer = audioPlayer else { return }
audioPlayer.play()
} catch {
}
}
}
}
.padding()
}
}
Thanks for your support!
Post not yet marked as solved
Is there a bug in this beta version that causes complications show placeholders only. This problem does not exist for watchOS 1.4
Post marked as Apple Recommended
The iPhone Target Build Phase for my Apple Watch companion app specifies the source of the Product to embed as: build/Debug-watchos, however,
the Watch build is located at build/Debug-watchsimulator.
I am receiving an error from Xcode when trying to install the Apple Watch app in the watch simulator, as follows: An application bundle was not found at the provided path. Provide a valid path to the desired application bundle.
Failed to install the requested application
Domain: NSPOSIXErrorDomain
Code: 2
Failure Reason: An application bundle was not found at the provided path.
Recovery Suggestion: Provide a valid path to the desired application bundle.
I have tried deleting the Watch target and re-adding the target but the misconfiguration remains. I have also tried adding my own Copy Build Phase but when selecting the Product for the Apple Watch companion app the same incorrect folder is used. Any ideas?
Post not yet marked as solved
Hi,
it seems like the wachOS sysdiagnose debug profile is no longer valid and needs to be updated. Any idea to whom we should reach out to get this fixed?
I am talking about the profile linked here:
https://developer.apple.com/bug-reporting/profiles-and-logs/?platform=watchos
Kind regards
Alex
Post not yet marked as solved
Is there a way to access the Core NFC Framework from within a watchOS app?
Post not yet marked as solved
I am running the watch on watchOS 9 and trying to enable "developer mode" (which requires a restart). However, upon restart, developer mode remains disabled. I tried several times, but developer mode just won't turn on.
any thought how to solve?
Post not yet marked as solved
I'm using the new watchOS 9 HKWorkoutActivity in my interval training app (Intervals Pro) for each interval. It's a great addition since all the intervals now show in the Apple Fitness app, however, if the workout has lots of activities then saving the workout is painfully slow. For example, on my Apple Watch Ultra I saved a workout with 63 activities and it took more than 1 minute. Here's a code snippet:
try await builder.endCollection(at: workoutEndDate)
try await builder.addMetadata(metadata)
try await builder.finishWorkout() // This is SLOW
Is anyone else having the same issue?
To demonstrate the issue you can look at a Test Flight build of Intervals Pro:
https://testflight.apple.com/join/Nn7iSOzY
Tap on the More tab in the iPhone app and then the Apple Watch Settings. On that screen you'll see a switch to either enable or disable workout activities. To demonstrate the issue, edit a timer to continue until manually stopped by changing the Number of Cycles to "Until Stopped". Then start the timer on the watch. Let it run for a period of time to create more than 50 intervals, for example, then stop the timer. Swipe to the leftmost screen on the watch, tap pause, then tap end. At that point you'll see how slow the workout saved.
Next, you can go back to the iPhone app, disable using workout activities and repeat the test. The workout will save quickly in this case.
I've filed a feedback.
Post not yet marked as solved
I'm using NavigationLink(value:label:) and .navigationDestination(for:destination:) in my SwiftUI watchOS app.
However navigating in the app causes the system to emit the following errors to the console:
<NavigationHostingControllerCache>: MISS at depth 1 in free stack
[NavigationHostingControllerCache_UIKit] <_TtGC7SwiftUI32NavigationStackHostingControllerVS_7AnyView_: 0x125015000> containment skipped because sourceNavigationController or destination were nil or sourceNavigationController was equal to destination
[NavigationHostingControllerCache_UIKit] Eject called for index: depth 1 in free stack
Library: SwiftUI, Subsystem: com.apple.SwiftUI , Category: Invalid Configuration
The navigation itself does work fine.
I'm wondering there's something I can do to fix it or if this is an internal issue of the SwiftUI framework and cannot be addressed by me? (i.e. I can ignore this)
Post not yet marked as solved
With the new interactive widgets brought by iOS 17, is it possible to indicate that an action (button tap or toggle use) has been triggered by firing an Haptic feedback to the user?
Post not yet marked as solved
I noticied that my workout session is sometimes being killed by apple when the app is in the background and it seems that the func workoutSession(_ workoutSession: HKWorkoutSession, didChangeTo toState: HKWorkoutSessionState, from fromState: HKWorkoutSessionState, date: Date) {
is only being called when the app comes back into the foreground.
I wonder if there is a way for us to get notified when the workout is about to die or has already been killed.
Thanks
Post not yet marked as solved
手表系统: 10.2
表现:从手机Watch App上看,表盘组件部分都显示关闭;从手表上看,表盘组件不展示
Post not yet marked as solved
I recently raised this post explaining how I couldn't seem to get watchOS 9 complications to work, and I've figured out a partial fix.
The original post details the issues with complications - and some are still valid - but this fix applies to both my complications and Home Screen / Lock Screen widgets.
I was following the various WWDC 2020/2022 videos and the Emoji Rangers sample code, adding bits here and there, and assuming they were completely valid. Sadly, this bit of code in the widget's dynamic intents IntentTimelineProvider getTimeline really just banjaxed everything:
// Create entries for one day, 15 minutes apart
let currentDate = Date()
for minuteOffset in stride(from: 0, to: 60 * 60 * 24, by: 15) {
let entryDate = Calendar.current.date(byAdding: .minute, value: minuteOffset, to: currentDate)!
entries.append(EventEntry(date: entryDate, event: event))
}
If I remove that, and generate a different timeline with specific dates and times (for example: now, in 10 mins, in 2 hours, in a day, etc.) the complications appear correctly, as do Home Screen and Lock Screen widgets.
The outstanding issues with complications are:
The previews all use the same data, but getSnapshot() is supposed to return the data specific to that event from the configuration, i.e. if let theId = configuration.event?.identifier. "Christmas" is correct, but "Gallery Opening" is using Christmas's data.
Once I've selected the event I want to use in a complication the edit screen shows it as totally blank, not even a placeholder:
I hope this little fix works for you guys. And, if you know how to fix the above issues, let me know.
(iOS 16.1 beta 1, Xcode 14.1 beta 1)
Post not yet marked as solved
Hi,
I have a watchOS app that records audio for an extended period of time and because the mic is active, continues to record in background mode when the watch face is off. However, when a call comes in or Siri is activated, recording stops because of an audio interruption. Here is my code for setting up the session:
private func setupAudioSession() {
let audioSession = AVAudioSession.sharedInstance()
do {
try audioSession.setCategory(.playAndRecord, mode: .default, options: [.overrideMutedMicrophoneInterruption])
try audioSession.setActive(true, options: .notifyOthersOnDeactivation)
} catch {
print("Audio Session error: \(error)")
}
}
Before this I register an interruption handler that holds a reference to my AudioEngine (which I start and stop each time recording is activated by the user):
_audioInterruptionHandler = AudioInterruptionHandler(audioEngine: _audioEngine)
And here is how this class implements recovery:
fileprivate class AudioInterruptionHandler {
private let _audioEngine: AVAudioEngine
public init(audioEngine: AVAudioEngine) {
_audioEngine = audioEngine
// Listen to interrupt notifications
NotificationCenter.default.addObserver(self, selector: #selector(handleAudioInterruption(notification:)), name: AVAudioSession.interruptionNotification, object: nil)
}
@objc private func handleAudioInterruption(notification: Notification) {
guard let userInfo = notification.userInfo,
let interruptionTypeRawValue = userInfo[AVAudioSessionInterruptionTypeKey] as? UInt,
let interruptionType = AVAudioSession.InterruptionType(rawValue: interruptionTypeRawValue) else {
return
}
switch interruptionType {
case .began:
print("[AudioInterruptionHandler] Interruption began")
case .ended:
print("[AudioInterruptionHandler] Interruption ended")
print("Interruption ended")
do {
try AVAudioSession.sharedInstance().setActive(true)
} catch {
print("[AudioInterruptionHandler] Error resuming audio session: \(error.localizedDescription)")
}
default:
print("[AudioInterruptionHandler] Unknown interruption: \(interruptionType.rawValue)")
}
}
}
Unfortunately, it fails with:
Error resuming audio session: Session activation failed
Is this even possible to do on watchOS? This code worked for me on iOS.
Thank you,
-- B.
Post not yet marked as solved
I am a watchOS 10.0 device, try to open the developer mode, according to the official website to enter the Settings > Privacy > Developer Mode. But I don't see the developer mode option, how do I turn on the developer mode for watchOS 10.0 device?
Post not yet marked as solved
Hello
I have been using apple products for quite some time now and am also updating my phone with latest beta software updates for watch, airpods 2 etc.
Recently, I have started facing an irritating issue - I am unable to control the volume via my apple watch crown for music playing on youtube music / spotify etc.
Earlier while operating the watch crown, I could lower/increase the volume of the music/videos on the "Now Playing" screen on the watch. But with recent updates its not happening. Please advise. TIA!
Software versions:
iphone - ios 17.4
apple watch 8 - watchOS 10.4
Post not yet marked as solved
Good morning,
I come to you for a question:
When I install my application on my iPhone for the first time, and I install the watch application from the native "Watch" application, the Watch Connectivity function does not work, I have to do the installation from Xcode to the watch for this function to work.
Is this normal? if yes, the problem will not arise during a publication?
I have the same problem when using watch and iPhone simulators, WatchConnectivity does not work.
I am this error code in Xcode:
-[WCSession handleIncomingUserInfoWithPairingID:]_block_invoke delegate (null) does not implement session:didReceiveUserInfo:, discarding incoming content
Here is the code for the iPhone and the watch:
In my iPhone app:
import WatchConnectivity
let userDefaultsDataVenantWatch = UserDefaults.standard
class PhoneDataModel : NSObject, WCSessionDelegate, ObservableObject {
static let shared = PhoneDataModel()
let session = WCSession.default
@Published var TableauSynchroIphoneVersWatch : [String:String] = ["0":"0"]
@Published var dataWatchVersIphone: [String:String] = ["":""]
override init() {
super.init()
if WCSession.isSupported() {
session.delegate = self
session.activate()
} else {
print("ERROR: Watch session not supported")
}
}
func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) {
if let error = error {
print("session activation failed with error: \(error.localizedDescription)")
return
}
}
func sessionDidBecomeInactive(_ session: WCSession) {
session.activate()
}
func sessionDidDeactivate(_ session: WCSession) {
session.activate()
}
func session(_ session: WCSession, didReceiveUserInfo userInfo: [String : Any]) {
guard let newCount = userInfo["TableauSynchroIphoneWatch"] as? [String:String] else {
print("ERROR: unknown data received from Watch TableauSynchroIphoneWatch")
return
}
DispatchQueue.main.async {
print(newCount)
}
}
}
In my Watch app:
import WatchConnectivity
let userDefaultsDataVenantIphone = UserDefaults.standard
var TableauVenantIphone:[String:String] = ["":""]
class WatchDataModel : NSObject, WCSessionDelegate, ObservableObject {
static let shared = WatchDataModel()
let session = WCSession.default
@Published var TableauSynchroIphoneWatch : [String:String] = ["0":"0"]
override init() {
super.init()
if WCSession.isSupported() {
session.delegate = self
session.activate()
} else {
print("ERROR: Watch session not supported")
}
}
func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) {
if let error = error {
print("session activation failed with error: \(error.localizedDescription)")
return
}
}
func session(_ session: WCSession, didReceiveUserInfo userInfo: [String : Any]) {
guard let newCount = userInfo["TableauSynchroIphoneVersWatch"] as? [String:String] else {
print("ERROR: unknown data received from Watch TableauSynchroIphoneWatch")
return
}
DispatchQueue.main.async {
print(newCount)
}
}
}
Thank for your answers !
Post not yet marked as solved
I'm building complications using WidgetKit and SwiftUI. The complications work, but the previews don't appear right away when applying the .watchface.
How can I ensure the complication previews show up immediately when a user adds the watch face?
Any guidance is appreciated.