From bc39b6b8cfc59bcba934a181f71df9d9e756ea42 Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Fri, 22 Mar 2024 10:20:46 +0100 Subject: [PATCH] fix: vue 3 log warning causes error on iOS (#7364) Co-authored-by: Szymon Stasik Co-authored-by: Mark Anderson --- android/capacitor/src/main/assets/native-bridge.js | 12 ++++++------ core/native-bridge.ts | 11 +++++------ ios/Capacitor/Capacitor/assets/native-bridge.js | 12 ++++++------ 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/android/capacitor/src/main/assets/native-bridge.js b/android/capacitor/src/main/assets/native-bridge.js index f0f70e6b3..d2e2a91ab 100644 --- a/android/capacitor/src/main/assets/native-bridge.js +++ b/android/capacitor/src/main/assets/native-bridge.js @@ -379,15 +379,15 @@ var nativeBridge = (function (exports) { typeof c.dir === 'function'); }; const serializeConsoleMessage = (msg) => { - if (typeof msg === 'object') { - try { + try { + if (typeof msg === 'object') { msg = JSON.stringify(msg); } - catch (e) { - // ignore - } + return String(msg); + } + catch (e) { + return ''; } - return String(msg); }; const platform = getPlatformId(win); if (platform == 'android' || platform == 'ios') { diff --git a/core/native-bridge.ts b/core/native-bridge.ts index 9f3653c7a..6f4d61b0c 100644 --- a/core/native-bridge.ts +++ b/core/native-bridge.ts @@ -407,15 +407,14 @@ const initBridge = (w: any): void => { }; const serializeConsoleMessage = (msg: any): string => { - if (typeof msg === 'object') { - try { + try { + if (typeof msg === 'object') { msg = JSON.stringify(msg); - } catch (e) { - // ignore } + return String(msg); + } catch (e) { + return ''; } - - return String(msg); }; const platform = getPlatformId(win); diff --git a/ios/Capacitor/Capacitor/assets/native-bridge.js b/ios/Capacitor/Capacitor/assets/native-bridge.js index f0f70e6b3..d2e2a91ab 100644 --- a/ios/Capacitor/Capacitor/assets/native-bridge.js +++ b/ios/Capacitor/Capacitor/assets/native-bridge.js @@ -379,15 +379,15 @@ var nativeBridge = (function (exports) { typeof c.dir === 'function'); }; const serializeConsoleMessage = (msg) => { - if (typeof msg === 'object') { - try { + try { + if (typeof msg === 'object') { msg = JSON.stringify(msg); } - catch (e) { - // ignore - } + return String(msg); + } + catch (e) { + return ''; } - return String(msg); }; const platform = getPlatformId(win); if (platform == 'android' || platform == 'ios') {