NativeScript / ios

NativeScript for iOS and visionOS using V8
https://docs.nativescript.org/guide/ios-marshalling
131 stars 33 forks source link

iOS crash: App does not run anymore when built with Xcode 15.3 for iOS 17.4 #241

Closed gabrielbiga closed 8 months ago

gabrielbiga commented 8 months ago

Since my personal iPhone 12 updated to the iOS 17.4 (21E219) version I cannot run my app anymore. At first, I thought that was only my APP, so I tried to run the Angular example and I got the exact same error. The weirdest thing is if I run the app on the physical iPhone, it crashes giving the error, but if I run it on an emulator, nothing happens, the app runs ok. I just sent an APP for AppStore review and it was rejected because it's crashing at the splash screen.

I had some success replacing the NSURLSessionConfiguration call with NSURLConnection patching inside the @nativescript/core package, but the app is still failing at some native access. Maybe the native bridge is broken at the latest version + latest SDK.

***** Fatal JavaScript exception - application has been terminated. *****
  NativeScript encountered a fatal error:
  Error calling module function
  ReferenceError: NSURLSessionConfiguration is not defined
  File: (file: src/webpack:/demong/webpack/bootstrap:27:0)
  StackTrace:
    ../../node_modules/@nativescript/core/http/http-request/index.ios.js(file: src/webpack:/demong/node_modules/@nativescript/core/http/http-request/index.ios.js:15:0)
    at __webpack_require__(file: src/webpack:/demong/webpack/bootstrap:24:0)
    at fn(file: src/webpack:/demong/webpack/runtime/hot module replacement:62:0)
    at ../../node_modules/@nativescript/core/xhr/index.js(file:///app/vendor.js:47375:63)
    at __webpack_require__(file: src/webpack:/demong/webpack/bootstrap:24:0)
    at fn(file: src/webpack:/demong/webpack/runtime/hot module replacement:62:0)
    at (file: src/webpack:/demong/node_modules/@nativescript/core/globals/index.js:263:43)
    at loadModule(file: src/webpack:/demong/node_modules/@nativescript/core/globals/index.js:202:0)
    at get(file: src/webpack:/demong/node_modules/@nativescript/core/globals/index.js:8:0)
    at (file: src/webpack:/demong/node_modules/@nativescript/core/fetch/index.js:12:0)
    at (file: src/webpack:/demong/node_modules/@nativescript/core/fetch/index.js:17:13)
    at ../../node_modules/@nativescript/core/fetch/index.js(file: src/webpack:/demong/node_modules/@nativescript/core/fetch/index.js:539:1)
    at __webpack_require__(file: src/webpack:/demong/webpack/bootstrap:24:0)
    at fn(file: src/webpack:/demong/webpack/runtime/hot module replacement:62:0)
    at (file: src/webpack:/demong/node_modules/@nativescript/core/globals/index.js:265:45)
    at loadModule(file: src/webpack:/demong/node_modules/@nativescript/core/globals/index.js:202:0)
    at get(fi<\M-b\M^@\M-&>

Versions used: Nativescript Angular Demo APP (https://github.com/NativeScript/angular) Xcode: 15.3.0 iOS: 17.4 (21E219) iPhone: 12 NS Cli: 8.6.5

apburgess commented 8 months ago

There seems to be an issue with Xcode 15.3.0, I hit the same issue with crash on launch on device, but OK on simulator. Can you downgrade to 15.2.0? That resolve the issue for me.

I have suspicions it's down to a new clang option that's being added (-fdefine-target-os-macros) but that hasn't been added yet (but the 15.3 headers rely on).. but I'm not 100% sure (digging into it at the moment).

gabrielbiga commented 8 months ago

Hello @apburgess thanks for your answer and your investigation, but the error was just fixed by https://github.com/NativeScript/ios/pull/242. I just tested and it back everything 100% to normal. Many thanks all who put some effort on it!