Nativescript app is not running with Firebase in IOS


#1

Hi,

I have integrated Firebase plugin with my nativescript app. I followed the instructions mentioned Here. In android it is working fine but in IOS, it is building fine but while running it is giving error like the following.

CONSOLE LOG file:///app/tns_modules/nativescript-plugin-firebase/firebase.js:1165:18: Error in firebase.addChildEventListener: TypeError: null is not an object (evaluating ‘firebase.instance.childByAppendingPath’)
CONSOLE ERROR file:///app/tns_modules/@angular/core/bundles/core.umd.js:3491:32: EXCEPTION: Uncaught (in promise): TypeError: null is not an object (evaluating ‘firebase.instance.childByAppendingPath’)
CONSOLE ERROR file:///app/tns_modules/@angular/core/bundles/core.umd.js:3496:36: ORIGINAL STACKTRACE:
CONSOLE ERROR file:///app/tns_modules/@angular/core/bundles/core.umd.js:3497:36: resolvePromise@file:///app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:416:40
file:///app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:393:27
file:///app/tns_modules/nativescript-plugin-firebase/firebase.js:1166:13
ZoneAwarePromise@file:///app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:465:37
addValueEventListener@file:///app/tns_modules/nativescript-plugin-firebase/firebase.js:1144:21
file:///app/shared/firebase-feed.service.js:24:43
subscribe@file:///app/tns_modules/rxjs/Observable.js:45:37
connect@file:///app/tns_modules/rxjs/observable/ConnectableObservable.js:37:27
call@file:///app/tns_modules/rxjs/observable/ConnectableObservable.js:101:56
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26
getFeedItems@file:///app/shared/question/question.component.js:32:23
ngOnInit@file:///app/shared/question/question.component.js:43:26
ngDoCheck
detectChangesInternal

Any help will be appretiated.

Thanks,

Envioronment Details:

CLI: 2.5.0
Cross-platform modules: tns-core-modules@2.4.4
Runtime(s): “tns-ios”: {
“version”: “2.5.0”
}
Plugin(s): nativescript-plugin-firebase@^3.9.3


#2

@Soumen can you show me where and how you init Firebase?


#3

Hi,

Thanks for your reply @StudderVOF. In my main.ts file I have called the init function of firebase.

Here is the code snippet.

import { platformNativeScriptDynamic } from “nativescript-angular/platform”;
import { AppModule } from “./app.module”;
import firebase = require(“nativescript-plugin-firebase”);

firebase.init({
persist: false
}).then(
function(instance) {
console.log(“firebase.init done”);
},
function(error) {
console.log("firebase.init error: " + error);
}
);

platformNativeScriptDynamic().bootstrapModule(AppModule);


#4

This is a known problem that we are encountering when using Firebase with Angular. https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/272

If you can, chime in on that issue for the fix to be pushed. Otherwise the workaround is in that issue log


#5

Thanks @jen.looper for your suggestion. I made the change in this file as specified in the above link. But now I am getting a new error. I am pasting the stack trace with the error text highlighted in bold. Please have a look into this.

2017-02-23 02:07:58.606 questNewS[652] [Firebase/Core][I-COR000001] Configuring the default app.
2017-02-23 02:07:58.619 questNewS[652:] <FIRAnalytics/INFO> Firebase Analytics v.3600000 started
2017-02-23 02:07:58.643: <FIRInstanceID/WARNING> FIRInstanceID AppDelegate proxy enabled, will swizzle app delegate remote notification handlers. To disable add “FirebaseAppDelegateProxyEnabled” to your Info.plist and set it to NO
2017-02-23 02:07:58.621 questNewS[652:] <FIRAnalytics/INFO> To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/Y0Yjwu)
CONSOLE LOG file:///app/tns_modules/nativescript-plugin-firebase/firebase.js:498:18: Error in firebase.init: Error: Expecting function got: undefined
CONSOLE LOG file:///app/main.js:11:16: firebase.init done
2017-02-23 02:07:58.975 questNewS[652:] <FIRAnalytics/INFO> Firebase Analytics enabled
2017-02-23 02:07:59.352 questNewS[652] [Firebase/Core][I-COR000018] Already sending logs.
CONSOLE LOG file:///app/tns_modules/@angular/core/bundles/core.umd.js:111:20: Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.
***** Fatal JavaScript exception - application has been terminated. *****
Native stack trace:
1 0x8c12c5 NativeScript::FFICallbackNativeScript::ObjCMethodCallback::ffiClosureCallback(ffi_cif*, void*, void**, void*)
2 0xd767b5 ffi_closure_inner_SYSV
3 0xd790b8 ffi_closure_SYSV
4 0x20b7d841
5 0x20b7178f
6 0x20b7161f
7 0x20b022c3
8 0x20b20bb5
9 0x20b21653
10 0x1dc7bf15
11 0x1dc7a191
12 0x1dc7a5a7
13 0x1dbc9533 CFRunLoopRunSpecific
14 0x1dbc9341 CFRunLoopRunInMode
15 0x1f3a0bfd GSEventRunModal
16 0x22dd7e27
17 0x22dd2551 UIApplicationMain
18 0xd7902c ffi_call_SYSV
19 0xd764f9 ffi_call
20 0x88d397 NativeScript::FFICall::call(JSC::ExecState*)
21 0xb5a40f JSC::LLInt::setUpCall(JSC::ExecState*, JSC::Instruction*, JSC::CodeSpecializationKind, JSC::JSValue, JSC::LLIntCallLinkInfo*)
22 0xb59e8b llint_slow_path_call
23 0xb615ab llint_entry
24 0xb615b7 llint_entry
25 0xb615b7 llint_entry
26 0xb615b7 llint_entry
27 0xb5be61 vmEntryToJavaScript
28 0xb1253f JSC::JITCode::execute(JSC::VM*, JSC::ProtoCallFrame*)
29 0xaf4e7b JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&)
30 0xc20213 JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&, WTF::NakedPtrJSC::Exception&)
31 0x89a335 NativeScript::GlobalObject::moduleLoaderEvaluate(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue, JSC::JSValue, JSC::JSValue)
JavaScript stack trace:
1 measure@file:///app/tns_modules/tns-core-modules/ui/core/view.js:96:124
2 measureChild@file:///app/tns_modules/tns-core-modules/ui/core/view-common.js:977:26
3 onMeasure@file:///app/tns_modules/tns-core-modules/ui/action-bar/action-bar.js:200:35
4 measure@file:///app/tns_modules/tns-core-modules/ui/core/view.js:93:27
5 measureChild@file:///app/tns_modules/tns-core-modules/ui/core/view-common.js:977:26
6 onMeasure@file:///app/tns_modules/tns-core-modules/ui/page/page.js:369:57
7 measure@file:///app/tns_modules/tns-core-modules/ui/core/view.js:93:27
8 measureChild@file:///app/tns_modules/tns-core-modules/ui/core/view-common.js:977:26
9 measurePage@file:///app/tns_modules/tns-core-modules/ui/frame/frame.js:234:40
10 onMeasure@file:///app/tns_modules/tns-core-modules/ui/frame/frame.js:216:38
11 measure@file:///app/tns_modules/tns-core-modules/ui/core/view.js:93:27
12 _layoutRootView@file:///app/tns_modules/tns-core-modules/ui/utils.js:42:25
13 layoutSubviews@file:///app/tns_modules/tns-core-modules/application/application.js:41:40
14 UIApplicationMain@[native code]
15 start@file:///app/tns_modules/tns-core-modules/application/application.js:251:30
16 bootstrapApp@file:///app/tns_modules/nativescript-angular/platform-common.js:67:28
17 bootstrapModule@file:///app/tns_modules/nativescript-angular/platform-common.js:55:26
18 anonymous@file:///app/main.js:15:57
19 evaluate@[native code]
20 moduleEvaluation@[native code]
21 @[native code]
22 promiseReactionJob@[native code]
JavaScript error:
file:///app/tns_modules/tns-core-modules/ui/core/view.js:96:124: JS ERROR Error: onMeasure() did not set the measured dimension by calling setMeasuredDimension() ProxyViewContainer(65)

Thanks,


#6

this seems like an error in your Firebase Init code. Below is how I use it:

import { platformNativeScriptDynamic } from "nativescript-angular/platform";
import firebase = require("nativescript-plugin-firebase");

import { AppModule } from "./app.module";

firebase.init({}).then(
  (instance) => {
    console.log("firebase.init done");
  },
  (error) => {
    console.log("firebase.init error: " + error);
  }
);

platformNativeScriptDynamic().bootstrapModule(AppModule);

#7

Hello @jen.looper I specified my firebase init code above. But, even if I am changing the init code with your’s, I am getting the same error.


#8

I see you opened an issue on Eddy’s plugin repo, which we’ll monitor, thanks