这真的很奇怪。 我买了一台 M2 Mac,并将数据从旧的 Intel 机器迁移到新机器。
现在,我的 nativescript-app 不再在新机器上运行。具体来说,当我运行
ns run ios --device 0000000000
时,它会抛出错误。
错误是:
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-&>
有趣的是,当我在模拟器上运行该应用程序时,它可以工作。该错误仅发生在真实设备上。 我还尝试再次从我的旧 Mac 上运行它,以确保没有错误 - 并且应用程序也运行良好。 接下来,我尝试直接从 XCode 运行它,而不是使用 ns run 命令。同样的错误。
Discord 频道上的一些人认为苹果可能存在安全问题,导致该应用程序无法运行。但该错误并没有真正表明这一点。
有什么想法吗?
该问题显然是 Apple 方面当前 XCode 版本(15.3)中的一个错误。它与环境变量定义有关,并且有一个修复程序。
此外,它将在即将推出的 NS 版本(8.7)中修复。