nativescript

Nativescript app throws error on device after migrating from my Intel Mac to an M2-Mac


This is really weird. I got an M2 Mac and made a data migration form my old Intel machine to the new one.

Now, my nativescript-app doesn't work on the new machine anymore. Specifically, it throws an error when I run ns run ios --device 0000000000. The error is:

NativeScript encountered a fatal error:
  Error calling module function
  ReferenceError: NSURLSessionConfiguration is not defined
  File: (file: app/webpack:/redacted-app/webpack/bootstrap:27:0)
  StackTrace:
        ./node_modules/@nativescript/core/http/http-request/index.ios.js(file: app/webpack:/redacted-app/node_modules/@nativescript/core/http/http-request/index.ios.js:15:0)
        at __webpack_require__(file: app/webpack:/redacted-app/webpack/bootstrap:24:0)
        at fn(file: app/webpack:/redacted-app/webpack/runtime/hot module replacement:61:0)
        at ./node_modules/@nativescript/core/http/index.js(file:///app/vendor.js:12322:71)
        at __webpack_require__(file: app/webpack:/redacted-app/webpack/bootstrap:24:0)
        at fn(file: app/webpack:/redacted-app/webpack/runtime/hot module replacement:61:0)
        at ./node_modules/@nativescript/core/index.js(file:///app/vendor.js:13317:64)
        at __webpack_require__(file: app/webpack:/redacted-app/webpack/bootstrap:24:0)
        at fn(file: app/webpack:/redacted-app/webpack/runtime/hot module replacement:61:0)
        at ./app/app.js(file: app/webpack:/redacted-app/app/app.js:3:38)
        at __webpack_require__(file: app/webpack:/redacted-app/webpack/bootstrap:24:0)
        at __webpack_exec__(file:///app/bundle.js:15461:39)
        at (file:///app/bundle.js:15462:318)
        at __webpack_require__.X(file: app/webpack:/redacted-app/webpack/runtime/startup entrypoint:6:0)
        at (file:///app/bundle.js:15462:47)
        at (file:///<\M-b\M^@\M-&>

Interestingly, when I run the app on a simulator, it works. The error only occurs on a real device. I also tried to run it from my old Mac again, to make sure there's no error there - and the app's running fine as well. Next, I tried running it directly from XCode instead of using the ns run command. Same error.

Some guys on the Discord-Channel think that there might be an Apple security thing in place that prevents the app from running. But the error doesn't really suggest that.

Any ideas?


Solution

  • The problem was apparently a bug on Apple's side in the current XCode Version (15.3). It is related to an env variable definition and there's a fix for this.

    Also, it will be fixed in the upcoming NS-Version (8.7).