Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Error: "null is not an object (evaluating 'app.registerForRemoteNotifications')" #218

Closed
NordlingDev opened this issue Nov 21, 2016 · 4 comments
Assignees
Labels
Milestone

Comments

@NordlingDev
Copy link

Latest version of this plugin makes the app unable to launch because of this error:

CONSOLE LOG file:///app/tns_modules/nativescript-plugin-firebase/firebase.js:115:18: Error in firebase.addOnMessageReceivedCallback: TypeError: null is not an object (evaluating 'utils.ios.getter(UIApplication, UIApplication.sharedApplication).applicationIconBadgeNumber = 0')
CONSOLE LOG file:///app/tns_modules/nativescript-plugin-firebase/firebase.js:217:20: User granted push notifications? true
1   0x10bb23f6b NativeScript::FFICallback<NativeScript::ObjCBlockCallback>::ffiClosureCallback(ffi_cif*, void*, void**, void*)
2   0x10c2bd90e ffi_closure_unix64_inner
3   0x10c2be2c2 ffi_closure_unix64
4   0x10f53212e _dispatch_client_callout
5   0x10f517523 _dispatch_queue_serial_drain
6   0x10f517cf3 _dispatch_queue_invoke
7   0x10f51809b _dispatch_queue_override_invoke
8   0x10f519a0e _dispatch_root_queue_drain
9   0x10f5197b4 _dispatch_worker_thread3
Nov 21 14:33:58 Filips-MBP fbapp[12667]: 10  0x10f8de736 _pthread_wqthread
Nov 21 14:33:58 Filips-MBP fbapp[12667]: 11  0x10f8de211 start_wqthread
Nov 21 14:33:58 Filips-MBP fbapp[12667]: file:///app/tns_modules/nativescript-plugin-firebase/firebase.js:219:12: JS ERROR TypeError: null is not an object (evaluating 'app.registerForRemoteNotifications')
Nov 21 14:33:58 Filips-MBP com.apple.CoreSimulator.SimDevice.670EB2F6-C74D-4FBE-87B8-06BDB2155BB8.launchd_sim[736] (UIKitApplication:com.fbapp.app[0x2005][12667]): Service exited with abnormal code: 1
@NordlingDev NordlingDev changed the title Error: "app is not an object" Error: "null is not an object (evaluating 'app.registerForRemoteNotifications')" Nov 21, 2016
@NordlingDev
Copy link
Author

Just noticed it's the same error as #205. I'm on TNS 2.4.0 if that says anything?

EddyVerbruggen added a commit that referenced this issue Nov 21, 2016
Error: "null is not an object (evaluating 'app.registerForRemoteNotifications')" #218
@EddyVerbruggen
Copy link
Owner

Such a weird error.. can you try applying this change locally? That's probably the quickest way to test it..

@NordlingDev
Copy link
Author

NordlingDev commented Nov 21, 2016

@EddyVerbruggen - I shortened that change a little, but yes it does work now:

if(app === null) app = utils.ios.getter(UIApplication, UIApplication.sharedApplication);
if(app !== null) app.registerForRemoteNotifications();

@EddyVerbruggen
Copy link
Owner

Perfect, consider that very-soon-to-be-released!

@EddyVerbruggen EddyVerbruggen added this to the 3.8.3 milestone Nov 21, 2016
@EddyVerbruggen EddyVerbruggen self-assigned this Nov 21, 2016
EddyVerbruggen added a commit that referenced this issue Apr 18, 2017
Error: "null is not an object (evaluating 'app.registerForRemoteNotifications')" #218
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants