-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught ReferenceError: NativeScriptViewFactory is not defined on iOS built with mode --release. #10519
Comments
Can you confirm this happens even after running Please also include the contents of your |
This can also be seen if you haven't cleared DerivedData in awhile.
Then |
@rigor789 Yes it happens after running ns clean. Here is my package.json. {
"name": "app",
"main": "./src/main.ts",
"version": "2.1.1",
"private": true,
"nativescript": {
"id": "example.example.app"
},
"dependencies": {
"@angular/animations": "~17.3.4",
"@angular/common": "~17.3.4",
"@angular/compiler": "~17.3.4",
"@angular/core": "~17.3.4",
"@angular/forms": "~17.3.4",
"@angular/platform-browser": "~17.3.4",
"@angular/platform-browser-dynamic": "~17.3.4",
"@angular/router": "~17.3.4",
"@heywhy/ns-secure-storage": "~0.3.0",
"@nativescript-community/push": "~1.1.11",
"@nativescript-community/ui-image": "~4.3.40",
"@nativescript-community/ui-mapbox": "~6.2.27",
"@nativescript-community/ui-material-bottomnavigationbar": "~7.2.49",
"@nativescript-community/ui-material-slider": "^7.2.49",
"@nativescript-community/ui-pager": "~14.1.19",
"@nativescript-community/ui-pulltorefresh": "~2.5.3",
"@nativescript-community/universal-links": "^3.0.1",
"@nativescript/angular": "~17.0.0",
"@nativescript/appavailability": "~2.0.0",
"@nativescript/auto-fit-text": "~1.0.3",
"@nativescript/biometrics": "~1.3.1",
"@nativescript/camera": "~5.1.0",
"@nativescript/contacts": "~2.1.0",
"@nativescript/core": "~8.7.0",
"@nativescript/datetimepicker": "~2.1.13",
"@nativescript/geolocation": "~8.3.1",
"@nativescript/haptics": "^3.0.2",
"@nativescript/imagepicker": "~3.1.1",
"@nativescript/iqkeyboardmanager": "~2.1.1",
"@nativescript/social-share": "~2.3.0",
"@nativescript/tailwind": "^2.0.1",
"@nativescript/theme": "~3.0.1",
"@nstudio/ui-collectionview": "~5.1.8",
"@triniwiz/nativescript-star-ratings": "^2.0.3",
"anchorme": "^3.0.5",
"dayjs": "^1.11.10",
"geolocation-utils": "~1.2.5",
"global": "^4.4.0",
"google-libphonenumber": "~3.2.34",
"jwt-decode": "3.1.2",
"lodash": "^4.17.21",
"nativescript-audio": "^6.2.6",
"nativescript-barcodescanner": "~4.1.2",
"nativescript-calendar": "~3.0.0",
"nativescript-clipboard": "^2.1.1",
"nativescript-feedback": "^2.0.0",
"nativescript-hook": "~0.2.5",
"nativescript-imagecropper": "~4.0.3",
"nativescript-inappbrowser": "^3.2.0",
"nativescript-phone": "^3.0.3",
"nativescript-uuid-v2": "~2.0.1",
"ngx-mask": "^17.0.7",
"rxjs": "~7.8.1",
"short-crypt": "^3.0.6",
"tailwindcss": "~3.4.3",
"throttle-debounce": "~5.0.0",
"ts-deepmerge": "^7.0.0",
"zone.js": "~0.14.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~17.3.4",
"@angular/compiler-cli": "~17.3.4",
"@nativescript/android": "~8.7.0",
"@nativescript/debug-ios": "~1.0.0",
"@nativescript/ios": "8.7.0",
"@nativescript/types": "~8.7.0",
"@nativescript/types-android": "~8.7.0",
"@nativescript/types-ios": "~8.7.0",
"@nativescript/webpack": "^5.0.19",
"@ngtools/webpack": "~17.3.4",
"@types/lodash": "~4.17.0",
"@types/node": "~20.12.7",
"@types/throttle-debounce": "^5.0.2",
"postcss": "^8.4.38",
"postcss-loader": "^8.1.1",
"prettier": "~3.2.5",
"prettier-plugin-organize-imports": "^3.2.4",
"prettier-plugin-tailwindcss": "^0.5.13",
"typescript": "~5.4.5"
},
"packageManager": "yarn@4.1.0"
} |
@NathanWalker, I ran rm -rf ~/Library/Developer/Xcode/DerivedData and then ns clean but it still returns the same error. |
I am also having this exact error. Please can we get help with this ? @NathanWalker |
@NathanWalker @paulmlilo apparently i inspected the error to the nodemudles and figured the nativescript core ios utils folder has an index.js folder and this function is the one causing my app to break, : export function getWindow() { please what do you need to do ? |
I can repro this just using a blank sample project. I'm on a 2019 Intel MBP running macOS 14.4.1, with Xcode 15.3, iOS SDK 17.4 and ns 8.7.0. % ns create vue-sample --vue --ts
% cd vue-sample
% ns run ios # works fine, runs on my attached device
% ns run ios --bundle --release # runs, then crashes on my attached device The generated {
"name": "vue-sample",
"main": "app/app.ts",
"version": "1.0.0",
"private": true,
"dependencies": {
"@nativescript/core": "~8.7.0",
"@nativescript/theme": "~3.0.2",
"nativescript-vue": "~2.9.3"
},
"devDependencies": {
"@nativescript/ios": "8.7.0",
"@nativescript/types": "~8.7.0",
"@nativescript/webpack": "~5.0.19",
"@types/node": "~17.0.21",
"nativescript-vue-template-compiler": "~2.9.3",
"typescript": "~5.4.0",
"vue": "~2.6.12"
}
} Crashes with:
Webpack was a red herring. When I explicitly set It doesn't even have to be a Vue example. I get the same even when doing a vanilla TS project: |
I got back on my feet again by downgrading to |
I'm curious @pazaan @israelglory @paulmlilo if the projects where you're seeing this have a build.xcconfig or Podfile you could share?
|
v20.3.1 |
We happen to have a fix in |
% node -v
v20.12.2
% npm -v # Intentionally downgraded because of https://github.com/NativeScript/NativeScript/issues/10509
10.3.0
% ns -v
8.7.0
✔ Up to date.
% ruby --version
ruby 2.7.8p225 (2023-03-30 revision 1f4d455848) [x86_64-darwin22]
% pod --version
1.15.2 I don't have a % find . -name "*Podfile*"
% @NathanWalker Which % find . -name build.xcconfig
./platforms/ios/build/Release-iphoneos/exampleapp.xcarchive/Products/Applications/exampleapp.app/build.xcconfig
./platforms/ios/build/Debug-iphoneos/exampleapp.xcarchive/Products/Applications/exampleapp.app/build.xcconfig
./platforms/ios/exampleapp/build.xcconfig
./platforms/ios/exampleapp/Resources/build.xcconfig
./node_modules/@nativescript/ios/framework/__PROJECT_NAME__/build.xcconfig
./App_Resources/iOS/build.xcconfig Edit: Assume you mean App_Resources...
|
Updating to % npm i -D @nativescript/ios@next
% ns run ios --clean --release # <--- still crashes |
Worked... |
I don't know if it's related, but I also had an issue on 8.7.0 (release build):
|
@tomcoonen was |
@rigor789 Yes, I tried manually and also using the migrate command. |
same error
any idea? |
@marcocasadio Could you share your
You can set that to 14 or higher as well. |
@pazaan the shared build.xcconfig was missing a minimum deployment target. If still see the issue, you can add the target line above ^. |
the same happens to me: This project is running on a macbookPro 16" 2019, Sonoma 14.5, Intel Core i9. buils.xcconfig:
Something curious is that this same project is executed on another macbookPro and does not present the error. |
@Ederagp On that Intel let's modify the build.xcconfig to only contain the following:
Then in your package.json, modify the dependencies to use a tilde to ensure it grabs latest patch versions after a clean like this: "@nativiscrpet/core": "~8.7.2"
"@nativiscrpet/ios": "~8.7.2" Also modify the
Then do a |
@NathanWalker |
Have you deleted DerivedData in Xcode? Mind sharing entire package.json as well? Would be curious to see it. |
Yes, I have deleted DerivedData. Xcode 15.4 (15F31d) package.json: |
Thank you that's helpful, one last thing, let's drop the package-lock.json (prob easiest just to upload it so we can see what's locked in there) here as well - one of those older deps in there could be holding your core version back (via a transient peer dep). |
@NathanWalker this is the packages-lock.json |
Perfect thank you! If in community discord https://nativescript.org/discord, you can ping me at wwwalkerrun, easier to chat about results there. |
@NathanWalker I've tried to change from 13.0 to 14.0 but still getting the error.
this is my package.json
and this is the build.xcconfig:
|
Just encountered this in a project that had been running just fine via Inside Xcode, performing |
Any update on this issue? Downgrading to @nativescript/core": "~8.6.2" and @nativescript/ios": "8.6.4" fixes this specific issue but introduces a problem with |
Issue Description
Nativescript version: 8.7.1
Environment: iOS 17.4.1
Build: Release
When I build the app for iOS in --release mode, the app crashes on launch with a Fatal error
***** Fatal JavaScript exception - application has been terminated. *****
NativeScript encountered a fatal error:
Uncaught ReferenceError: NativeScriptViewFactory is not defined
Reproduction
Relevant log output (if applicable)
No response
Environment
MacOs Sonoma, Apple M2 Pro Chip.
Nativescript iOS.
Please accept these terms
The text was updated successfully, but these errors were encountered: