Post

Replies

Boosts

Views

Activity

UpdateApplicationContext Not Receiving updates
Hi community. It's my first time trying WatchConnectivity kit. When I attempt to send ApplicationContext from phone, my debug print indicates that updateApplicationContext is working correctly. However, I'm having trouble receiving it form the paired watch simulator as nothing is shown on that end. Here are the code for the Phone Extension:     func sendDataToWatch(data: String) {         state.append(data)         do {             NSLog("sent by phone")             try WCSession.default.updateApplicationContext(["currentstate": state])         }         catch {             print(error)         }     } Here are the code for watch: func session(_ session: WCSession, didReceiveApplicationContext applicationContext: [String: Any]) {         print("Hello")         if let getState = applicationContext["currentstate"] as? [String]{             print("\(getState)")             self.state = getState[0]         }     } Any suggestion would be appreciated!
12
4
4.6k
Jun ’21
White Screen on Launch
Hi Apple Community. I'm currently beta testing my app via TestFlight. When my fellows downloaded the app, some of them's app does not load the UI (blank), but if touching the position the buttons were, the app still responds (like asking for permission and send notifications normally). But the screen keeps blank and the UI seems failed to load. I found 1 iPad Pro and 2 iPhone 11 Pro with this issue (all of them on iOS 14.6). I tired to use simulator to see if problem persists, but app on the simulator seems working normally. I'm using SwiftUI and no LaunchScreenFile was selected. Does anyone got the same issue? How could I fix that? Thanks!
2
0
2.2k
Jun ’21
Create ML not recognizing all samples
Hi folks! My sound classifier is not picking up all the sound samples in the subfolder. They are all .flac .mp3 .wav and .m4a files. I've also double checked that file type is possibly not the reason some samples were not recognized. Since Create ML is a complete blackbox, could anyone tell me how should I pre-process my sound samples so that they could all be recognized by the data loader? Thanks!
0
0
795
Jun ’21
Cannot Find "PhoneConnect" in Scope Error
Hi folks, I'm attempting to add WKConnectivity to a SwiftUI app. When I try to introduce the PhoneConnect class to my main view, the error occurred. How can I fix this issue? Here is the code: struct HomeView: View {     @State var Listen = false     @State var showAlert = false     @State var reach = "No"     @ObservedObject var connect = PhoneConnect() //Cannot find 'PhoneConnect' in scope import WatchConnectivity final class MessageViewModel: NSObject, ObservableObject {     @Published var messages: [String] = []     @Published var messagesData: [String] = []          var session: WCSession          init(session: WCSession = .default) {         self.session = session         super.init()         self.session.delegate = self         session.activate()     } } extension MessageViewModel: WCSessionDelegate {     func sessionDidBecomeInactive(_ session: WCSession) {     }          func sessionDidDeactivate(_ session: WCSession) {     }          func session(_ Session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) {         if let error = error {             print(error.localizedDescription)         } else {             print("The session has completed activation.")         }     }          //[String: Any]     func session(_ session: WCSession, didReceiveMessage message: [String : Any]) {         DispatchQueue.main.async {             let receivedState = message["State"] as? String ?? "Syncing"             print(receivedState)             self.messages.append(receivedState)         }     } }
1
0
950
Jun ’21
WatchOS Background Task Without WKExtendedRuntimeSession
Hi folks! I'm currently building a app that notifies users via haptics (when users are asleep) when detector detects unusual activities (ex. gas detector). I've searched for relevant APIs to keep the watchOS app running in background and I found WKExtendedRuntimeSession might be the only choice for me. However, the maximum time limit is only 30 minutes, which is not cool for keeping it running all the time. Is there any workarounds for this question? If I use location service to keep it alive, would my app be rejected by Apple? Thanks in advance!
2
0
1k
Jun ’21