Hi All, can anyone help me to the below issue? i used the WatchConnectivity to send data from iphone to watch app. Now i tried to run them on emulator (watch series 5, and iphone 15 pro)
I have an error when i tried to send message data from iphone app (react-native) to watch app:
{
"code": "EWCERRORDOMAIN7014",
"domain": "WCErrorDomain",
"message": "Payload could not be delivered.",
"nativeStackIOS": [
"0 releasev2 0x0000000101979c90 RCTJSErrorFromCodeMessageAndNSError + 112",
"1 releasev2 0x0000000101979bd0 RCTJSErrorFromNSError + 256",
"2 releasev2 0x000000010190c2b4 __41-[RCTModuleMethod processMethodSignature]_block_invoke_4.110 + 148",
"3 releasev2 0x000000010185003d __35-[RNWatch sendMessage:reply:error:]_block_invoke.116 + 77",
"4 WatchConnectivity 0x000000011428b176 __70-[WCSession _onqueue_notifyOfMessageError:messageID:withErrorHandler:]_block_invoke + 206",
"5 Foundation 0x0000000119095004 NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK + 7",
"6 Foundation 0x0000000119094f02 -[NSBlockOperation main] + 94",
"7 Foundation 0x0000000119097ef2 NSOPERATION_IS_INVOKING_MAIN + 17",
"8 Foundation 0x00000001190940aa -[NSOperation start] + 730",
"9 Foundation 0x0000000119098744 NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION + 17",
"10 Foundation 0x0000000119098385 __NSOQSchedule_f + 182",
"11 libdispatch.dylib 0x000000011434ca90 _dispatch_call_block_and_release + 12",
"12 libdispatch.dylib 0x000000011434dd3a _dispatch_client_callout + 8",
"13 libdispatch.dylib 0x000000011435126a _dispatch_continuation_pop + 874",
"14 libdispatch.dylib 0x00000001143502b0 _dispatch_async_redirect_invoke + 994",
"15 libdispatch.dylib 0x000000011436041e _dispatch_root_queue_drain + 372",
"16 libdispatch.dylib 0x0000000114360e88 _dispatch_worker_thread2 + 244",
"17 libsystem_pthread.dylib 0x0000000116800c0f _pthread_wqthread + 257",
"18 libsystem_pthread.dylib 0x00000001167ffbbf start_wqthread + 15"
],
"userInfo": {
"NSLocalizedDescription": "Payload could not be delivered."
}
}
Here is the class connector shared data on watch target:
class SharedDataConnecter: NSObject, ObservableObject {
var session: WCSession
init(session: WCSession = .default){
self.session = session
super.init()
if WCSession.isSupported(){
session.delegate = self
session.activate()
}
}
}
extension SharedDataConnecter: WCSessionDelegate{
func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) {
print("Active State: ", activationState.rawValue)
print("Error: ", error)
}
func session(_ session: WCSession, didReceiveMessage message: [String : Any], replyHandler: @escaping ([String : Any]) -> Void) {
print("AAAA message from app: ", message)
}
}