Skip to content

Segemntation fault: 11, when using Angular's firebase library (angularfire2) with firestore on iOS simulator #1062

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

Closed
philipfeldmann opened this issue Oct 29, 2017 · 3 comments

Comments

@philipfeldmann
Copy link

I'm using the standard ng template and trying to setup angularfire2 like described in the offical guide

In the app.module.ts I've added AngularFireModule.initializeApp to my imports. To this point everything works fine, at least I'm not getting any compilation errors.

When trying to add AngularFirestoreModule though and running tns run ios I'm getting the segmentation fault:
com.apple.CoreSimulator.SimDevice.(device code here)[2997] (UIKitApplication:org.nativescript.HelloWorld[0x796e][3022][7655]): Service exited due to signal: Segmentation fault: 11 sent by exc handler[0]

The only thing I've changed about the ng template is the app.module.ts like so:

import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
import { NativeScriptModule } from "nativescript-angular/nativescript.module";
import { AppRoutingModule } from "./app.routing";
import { AppComponent } from "./app.component";

import { ItemService } from "./item/item.service";
import { ItemsComponent } from "./item/items.component";
import { ItemDetailComponent } from "./item/item-detail.component";

import { AngularFireModule } from 'angularfire2';
import { AngularFirestoreModule } from 'angularfire2/firestore';

const config = {
// my firebase config
};

@NgModule({
    bootstrap: [
        AppComponent
    ],
    imports: [
        NativeScriptModule,
        AppRoutingModule,
        AngularFireModule.initializeApp(config, 'fir-test-4719f'),
        AngularFirestoreModule
    ],
    declarations: [
        AppComponent,
        ItemsComponent,
        ItemDetailComponent
    ],
    providers: [
        ItemService
    ],
    schemas: [
        NO_ERRORS_SCHEMA
    ]
})
/*
Pass your application module to the bootstrapModule function located in main.ts to start your app
*/
export class AppModule { }

Like I mentioned above this compiles just fine again when removing the FirestoreModule.

Any ideas of why this happens or how I can prevent it?

@danielgek
Copy link

@philipfeldmann i'm not sure AngularFire will work at all in Nativescript, if you need firebase you should try nativescript-plugin-firebase

@philipfeldmann
Copy link
Author

@danielgek I'm aware of this, however the nativescript plugin is written in raw javascript and doesn't support key features of angular such as reactive observables. Also, the angularfire2 extension is backed by the angular team.

It's really just a npm package and it doesn't have any browser related dependencies such as document, so it should be able to run.

@NickIliev
Copy link

NickIliev commented Oct 30, 2017

@philipfeldmann angularfire2 is not directly supported n NativeScript environment due to some incompatibilities - large discussion about the support for NativeScript can be found here. As pointed out in this thread one reasonable solution would be to wrap the library in NativeScript plugin. However, this is a non-trivial task as the library is obfuscated.

@ghost ghost removed the question label Oct 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants