Hello,
Thank you for your help.
On my main program, I ask to send information this way:
TableauAEnvoyer["TypeDeSeancePourLaSeance\(Load_nbSeancePagingView)"] = "\(SeanceSelectionnee)"
WatchDataModel.shared.TableauSynchroIphoneWatch = TableauAEnvoyer
WatchDataModel.shared.session.transferUserInfo(["TableauSynchroIphoneWatch":WatchDataModel.shared.TableauSynchroIphoneWatch])
I'm modify my code in my Watch app, but Xcode gives me an error:
Cannot override 'sessionDidBecomeInactive' which has been marked unavailable
Cannot override 'sessionDidDeactivate' which has been marked unavailable
In my Watch app, I'm add your code :
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 sessionDidBecomeInactive(_ session: WCSession) {
session.activate()
}
func sessionDidDeactivate(_ session: WCSession) {
session.activate()
}
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)
}
}
}
Post
Replies
Boosts
Views
Activity
Hello !
thank you for your help ! this helped me a lot !
I didn't know about the "UIGraphicsImageRenderer" function.
thank you !
Thank you for your answer. in this case, how can I go to a new view, and navigate between these two views?