[firebase-crashlytics AND firebase-messaging] iOS app crashes upon launch
rdlauer opened this issue · 6 comments
As the title suggests, after adding crashlytics and/or messaging to an iOS app, it crashes upon launch. This is easy to replicate:
ns create myapp(I chose plain TS)npm install @nativescript/firebase-coreandnpm install @nativescript/firebase-crashlytics- add the following to
app.ts:
import { firebase } from '@nativescript/firebase-core'
import '@nativescript/firebase-crashlytics';
await firebase().initializeApp();
- update
webpack.config.jsto fix build issue:
webpack.mergeWebpack({resolve: {
fallback: {
'fs': false,
'path': false,
'path-browserify': false,
}
}})
ns run ios--> simulator boots and crashes without error message
Hi @rdlauer have you downloaded the GoogleService-Info.plist from firebase and placed inside App_Resources/iOS by chance?
Yeah I did that as well (forgot to add it to my list of steps above!)
Do you happen to have the stack you see by chance? It could just be order of operations in how the init is setup as I don't see that here.
For example, with this setup I don't see what's described (and also see no webpack complaints - meaning no webpack config changes should be needed).
import { Application, ApplicationEventData } from '@nativescript/core';
import { firebase } from '@nativescript/firebase-core';
import '@nativescript/firebase-crashlytics';
Application.on(Application.launchEvent, async (args: ApplicationEventData) => {
await firebase().initializeApp().then(async() => {
const crashlytics = firebase().crashlytics();
if (crashlytics.checkForUnsentReports()) {
crashlytics.log('Sending unsent crash reports...');
crashlytics.sendUnsentReports();
}
});
// bootstrap app, eg:
runNativeScriptAngularApp({
appModuleBootstrap: () => platformNativeScript().bootstrapModule(AppModule)
});Possible to share the package.json by chance, would be curious there?
Hi @NathanWalker - thanks again for helping out here. I just created a new app and used your init code above...and it works! I've got a few notes here on little doc updates and will wrap these up in a PR soon.
FYI I DID still have to update the webpack config due to this error:
ERROR in ./node_modules/source-map/lib/read-wasm.js 30:15-30
Module not found: Error: Can't resolve 'path' in '/Users/roblauer/Documents/apps/fbtest/node_modules/source-map/lib'
If get a chance later, sharing the package.json would be interesting to see if something in there leads to the config issue (have not seen that before - using node 20.10.0 here).
Yeah no problem. I'm on node 20.11.
{
"name": "myapp",
"main": "app/app.ts",
"version": "1.0.0",
"private": true,
"dependencies": {
"@nativescript-community/ui-material-floatingactionbutton": "^7.2.29",
"@nativescript-community/ui-pulltorefresh": "^2.5.3",
"@nativescript/background-http": "^6.0.0",
"@nativescript/camera": "^5.1.1",
"@nativescript/core": "~8.6.2",
"@nativescript/datetimepicker": "^2.1.13",
"@nativescript/geolocation": "^8.3.1",
"@nativescript/haptics": "^3.0.2",
"@nativescript/imagepicker": "^3.0.1",
"@nativescript/iqkeyboardmanager": "^2.1.1",
"@nativescript/theme": "~3.0.2",
"@nstudio/nativescript-fluid-segmented-bar": "^1.0.2",
"@nstudio/nativescript-loading-indicator": "^4.3.4",
"@triniwiz/nativescript-image-cache-it": "^7.4.0",
"@triniwiz/nativescript-star-ratings": "^2.0.3",
"email-validator": "^2.0.4",
"just-clone": "^6.2.0",
"libphonenumber-js": "^1.10.53",
"nativescript-carousel": "^7.0.1",
"nativescript-drop-down": "^6.0.2",
"throttle-debounce": "^5.0.0"
},
"devDependencies": {
"@nativescript/android": "8.6.2",
"@nativescript/ios": "8.6.3",
"@nativescript/types": "~8.6.1",
"@nativescript/webpack": "~5.0.18",
"@types/throttle-debounce": "^5.0.2",
"typescript": "~5.3.3"
}
}