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

Crash after push notification confirmation #205

Closed
kjetilhp opened this issue Nov 10, 2016 · 4 comments
Closed

Crash after push notification confirmation #205

kjetilhp opened this issue Nov 10, 2016 · 4 comments
Assignees
Labels
Milestone

Comments

@kjetilhp
Copy link

Successfully deployed on device with identifier '1219619E-F3D9-4EBD-819A-F97BD4518BA6'.
Nov 10 14:38:47 awesome-3 pusherdev[63781]: objc[63781]: Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x116134998) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x115f59d38). One of the two will be used. Which one is undefined.
Nov 10 14:38:53 awesome-3 pusherdev[63781]: Normal message received by listener connection. Ignoring.
Nov 10 14:38:53 awesome-3 pusherdev[63781]: Could not successfully update network info during initialization.
Nov 10 14:38:53 awesome-3 pusherdev[63781]: <FIRAnalytics/INFO> Firebase Analytics v.3404000 started
Nov 10 14:38:53 awesome-3 pusherdev[63781]: <FIRAnalytics/INFO> To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/Y0Yjwu)
Nov 10 14:38:53 awesome-3 pusherdev[63781]: Firebase Crash Reporting: Successfully enabled
Nov 10 14:38:53 awesome-3 pusherdev[63781]: Getting container class internal daemon!
Nov 10 14:38:53 awesome-3 pusherdev[63781]: CONSOLE LOG file:///app/main.js:28:16: firebase.init done
Nov 10 14:38:53 awesome-3 pusherdev[63781]: assertion failed: 16B2555 14B72: libxpc.dylib + 62597 [17F6B510-0FB1-30D3-B29C-D74A5D63719E]: 0x7d
Nov 10 14:38:54 awesome-3 pusherdev[63781]: CONSOLE LOG file:///app/tns_modules/@angular/core/bundles/core.umd.js:78:20: Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.
Nov 10 14:38:55 awesome-3 pusherdev[63781]: [Common] _BSMachError: port b403; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND"
Nov 10 14:38:55 --- last message repeated 1 time ---
Nov 10 14:38:55 awesome-3 pusherdev[63781]: CONSOLE LOG file:///app/main.js:25:20: Firebase push token: dXp4mFpGlso:APA91bEEetlV6ZwaUcDqn-VUaDKsG6DACpCR_gW7hVhzEllgtfmgXBhDTqbLJwlIydi5f0aBwZXvUgIz52SkJc9xIaM0lVH_ubHKLJM9yP51R-LFws4f7t1NhYaUrnMl9eM-hnnHlR5c
Nov 10 14:38:56 awesome-3 pusherdev[63781]: <FIRAnalytics/INFO> Firebase Analytics enabled
Nov 10 14:42:19 awesome-3 pusherdev[63781]: CONSOLE LOG file:///app/tns_modules/nativescript-plugin-firebase/firebase.js:217:20: User granted push notifications? true
Nov 10 14:42:19 awesome-3 pusherdev[63781]: CONSOLE LOG file:///app/tns_modules/nativescript-plugin-firebase/firebase.js:219:20: null
Nov 10 14:42:19 awesome-3 pusherdev[63781]: 1   0x1052d4519 NativeScript::FFICallback<NativeScript::ObjCBlockCallback>::ffiClosureCallback(ffi_cif*, void*, void**, void*)
Nov 10 14:42:19 awesome-3 pusherdev[63781]: 2   0x10595751e ffi_closure_unix64_inner
Nov 10 14:42:19 awesome-3 pusherdev[63781]: 3   0x105957ed2 ffi_closure_unix64
Nov 10 14:42:19 awesome-3 pusherdev[63781]: 4   0x10664212e _dispatch_client_callout
Nov 10 14:42:19 awesome-3 pusherdev[63781]: 5   0x106627523 _dispatch_queue_serial_drain
Nov 10 14:42:19 awesome-3 pusherdev[63781]: 6   0x106627cf3 _dispatch_queue_invoke
Nov 10 14:42:19 awesome-3 pusherdev[63781]: 7   0x10662809b _dispatch_queue_override_invoke
Nov 10 14:42:19 awesome-3 pusherdev[63781]: 8   0x106629a0e _dispatch_root_queue_drain
Nov 10 14:42:19 awesome-3 pusherdev[63781]: 9   0x1066297b4 _dispatch_worker_thread3
Nov 10 14:42:19 awesome-3 pusherdev[63781]: 10  0x10887f736 _pthread_wqthread
Nov 10 14:42:19 awesome-3 pusherdev[63781]: 11  0x10887f211 start_wqthread
Nov 10 14:42:19 awesome-3 pusherdev[63781]: file:///app/tns_modules/nativescript-plugin-firebase/firebase.js:220:12: JS ERROR TypeError: null is not an object (evaluating 'app.registerForRemoteNotifications')
Nov 10 14:42:19 awesome-3 com.apple.CoreSimulator.SimDevice.1219619E-F3D9-4EBD-819A-F97BD4518BA6.launchd_sim[67239] (UIKitApplication:io.kjetil.pusher[0x631c][63781]): Service exited with abnormal code: 1

The app crashes right after I've confirmed the allow notification popup, I've tried the latest code from github but same result.

the line: file:///app/tns_modules/nativescript-plugin-firebase/firebase.js:219:20: null
is me printing out the value of the 'app' parameter in firebase.ios.js file (firebase._registerForRemoteNotifications = function (app))

same result when running on a device.

 ~/dev/nativescript/pusherdev  tns info
All NativeScript components versions information
┌──────────────────┬─────────────────┬────────────────┬───────────────┐
│ Component        │ Current version │ Latest version │ Information   │
│ nativescript     │ 2.3.0           │ 2.3.0          │ Up to date    │
│ tns-core-modules │ 2.3.0           │ 2.3.0          │ Up to date    │
│ tns-android      │                 │ 2.3.0          │ Not installed │
│ tns-ios          │ 2.3.0           │ 2.3.0          │ Up to date    │
└──────────────────┴─────────────────┴────────────────┴───────────────┘
 ~/dev/nativescript/pusherdev  tns doctor
Verifying CocoaPods. This may take more than a minute, please be patient.
  ◠ Installing iOS runtime.tns-ios@2.3.0 ../../../../../var/folders/d3/tp_dd2l953zd0xkrsbqtp48m0000gn/T/nativescript-check-cocoapods1161010-73943-wk7xwz.jwyee6zuxr/node_modules/tns-ios
  ◝ Verifying CocoaPods. This may take some time, please be patient..
Your components are up-to-date.

No issues were detected.
 ~/dev/nativescript/pusherdev 
@kjetilhp
Copy link
Author

seems that the line

var app = utils.ios.getter(UIApplication, UIApplication.sharedApplication);

in firebase.addOnMessageReceivedCallback,
is the problem, UIApplication.sharedApplication is null

After this I tried updating to nativescript@next since some googling recommended that for these problems, but now I never get the allow notification box and it seems that the messaging init is never run. The firebase.init is successful and I can store a value in the db, but now messaging.

@EddyVerbruggen
Copy link
Owner

Hi,

Thanks for the detailed report and trying a lot things.

Can you try adding

var app = utils.ios.getter(UIApplication, UIApplication.sharedApplication);

at line 219 so it becomes:

var app = utils.ios.getter(UIApplication, UIApplication.sharedApplication);
app.registerForRemoteNotifications();

@kjetilhp
Copy link
Author

ok, so changed back to nativescript 2.3.0 - but the master branch of your plugin
added code so it looks like:

if (!error) {
        console.log("User granted push notifications? " + granted);
        // applicationSettings.setBoolean("registered", true);
        var app = utils.ios.getter(UIApplication, UIApplication.sharedApplication);
        console.dir(app);
        app.registerForRemoteNotifications();
      } else {
        console.log("Error requesting push notification auth: " + error);
      }

Now it does not crash after confirming the notification dialog, however nothing is printet after confirm in the logs.

Project successfully built
Successfully deployed on device with identifier '1219619E-F3D9-4EBD-819A-F97BD4518BA6'.
Nov 11 10:57:46 awesome anotherpusher[88189]: objc[88189]: Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x120b41998) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x120966d38). One of the two will be used. Which one is undefined.
Nov 11 10:57:51 awesome anotherpusher[88189]: <FIRAnalytics/INFO> Firebase Analytics v.3404000 started
Nov 11 10:57:51 awesome anotherpusher[88189]: <FIRAnalytics/INFO> To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/Y0Yjwu)
Nov 11 10:57:52 awesome anotherpusher[88189]: Getting container class internal daemon!
Nov 11 10:57:52 awesome anotherpusher[88189]: CONSOLE LOG file:///app/main.js:14:16: firebase.init done
Nov 11 10:57:52 awesome anotherpusher[88189]: assertion failed: 16B2555 14B72: libxpc.dylib + 62597 [17F6B510-0FB1-30D3-B29C-D74A5D63719E]: 0x7d
Nov 11 10:57:52 awesome anotherpusher[88189]: CONSOLE LOG file:///app/tns_modules/@angular/core/bundles/core.umd.js:78:20: Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.
Nov 11 10:57:53 awesome anotherpusher[88189]: CONSOLE LOG file:///app/main.js:11:20: Firebase push token: fjKXx_YcT28:APA91bG5TaNso4XC7DQAnkRbaMPCpZuIRIDfDaE1hVm2x4frdVx41hv07QE8kotkth49hLG_dUoE7y-2BB1blQJaJuXtTgH9G_O5RrcUHVIEbG1XnkzEaRwoKAR-Ru99IZG45MnsW1hq
Nov 11 10:57:54 awesome anotherpusher[88189]: <FIRAnalytics/INFO> Firebase Analytics enabled
Nov 11 10:58:47 awesome anotherpusher[88189]: CONSOLE LOG file:///app/tns_modules/nativescript-plugin-firebase/firebase.js:217:20: User granted push notifications? true

I thought maybe it was resolved now so tried deploying it on my phone, same result there where I can confirm and it doesn't crash. Tried sending push messages from firebase but none received.

However, if I stop the app and start it manually on my phone it crashes. Haven't looked at the logs there though.

EddyVerbruggen added a commit that referenced this issue Nov 21, 2016
Error: "null is not an object (evaluating 'app.registerForRemoteNotifications')" #218
@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
@ryanzaatari
Copy link

ryanzaatari commented Sep 9, 2017

Hello @EddyVerbruggen , I have been struggling for couple of days now from a similar issue, I have the latest release of this plugin 4.0.6

here's my package.json file

{
"description": "Makhzoumi Foundation public application",
"license": "SEE LICENSE IN ",
"readme": "----NO DATA AVAILABLE----",
"repository": "",
"nativescript": {
"id": "com.makhzoumifoundation.general",
"tns-android": {
"version": "2.5.0"
},
"tns-ios": {
"version": "2.5.0"
}
},
"dependencies": {
"nativescript-cardview": "^1.3.2",
"nativescript-carousel": "^2.4.2",
"nativescript-floatingactionbutton": "^2.2.7",
"nativescript-intl": "^3.0.0",
"nativescript-loading-indicator": "^2.3.2",
"nativescript-orientation": "^1.6.1",
"nativescript-phone": "^1.3.0",
"nativescript-plugin-firebase": "^4.0.6",
"nativescript-pulltorefresh": "^1.1.10",
"nativescript-sqlite": "^1.1.7",
"nativescript-statusbar": "^1.0.0",
"nativescript-telerik-ui-pro": "file:///Users/ryanzaatari/Documents/Development/NativeScript/nativescript-ui-pro.tgz",
"nativescript-theme-core": "^1.0.4",
"nativescript-toasts": "^1.0.3",
"tns-core-modules": "^2.5.2"
},
"devDependencies": {
"babel-traverse": "6.24.1",
"babel-types": "6.24.1",
"babylon": "6.17.0",
"lazy": "1.0.11"
}
}

here's the crash report from firebase console

Exception name: EXC_BAD_ACCESS / KERN_INVALID_ADDRESS 1 NativeScript 4389574508 + 137068 2 NativeScript 4389573848 + 136408 3 NativeScript 4389625060 + 187620 4 NativeScript 4398674648 + 9237208 5 NativeScript 4398678448 + 9241008 6 Foundation -[__NSObserver _doit:] + 36880 7 CoreFoundation __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 868648 8 CoreFoundation _CFXRegistrationPost + 865992 9 CoreFoundation ___CFXNotificationPost_block_invoke + 865324 10 CoreFoundation -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1378800 11 CoreFoundation _CFXNotificationPost + 41948 12 Foundation postQueueNotifications + 378060 13 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 956596 14 CoreFoundation __CFRunLoopDoObservers + 946796 15 CoreFoundation __CFRunLoopRun + 947968 16 CoreFoundation CFRunLoopRunSpecific + 33492 17 GraphicsServices GSEventRunModal + 44928 18 UIKit UIApplicationMain + 472540 19 NativeScript 4398678080 + 9240640 20 NativeScript 4398673432 + 9235992 21 NativeScript 4398672176 + 9234736 22 NativeScript 4389459192 + 21752 23 NativeScript 4395964556 + 6527116 24 NativeScript 4395998996 + 6561556 25 NativeScript 4395999012 + 6561572 26 NativeScript 4395972612 + 6535172 27 NativeScript 4395578008 + 6140568 28 NativeScript 4395434548 + 5997108 29 NativeScript 4396875376 + 7437936 30 NativeScript 4389526752 + 89312 31 NativeScript 4397449420 + 8011980 32 NativeScript 4396001520 + 6564080 33 NativeScript 4395999012 + 6561572 34 NativeScript 4395999012 + 6561572 35 NativeScript 4395999012 + 6561572 36 NativeScript 4395972612 + 6535172 37 NativeScript 4395578008 + 6140568 38 NativeScript 4395434548 + 5997108 39 NativeScript 4396875580 + 7438140 40 NativeScript 4397432156 + 7994716 41 NativeScript 4389493232 + 55792 42 NativeScript 4389756244 + 318804 43 makhzoumifoundation 4378287836 + 24284 44 libdyld.dylib start + 5480

I don`t know if this helps, but I cannot find a "firebase.ios.js" file in my project ?
If what I've provided is not enough please let me know what else do I need to include here.

Edit:
I have noticed the 4.1.1 release and updated accordingly, but the issue persists.

Below is my firebase.nativescript.json file:

{
"using_ios": true,
"using_android": true,
"remote_config": false,
"messaging": true,
"crash_reporting": true,
"storage": false,
"facebook_auth": false,
"google_auth": false,
"admob": false,
"invites": false
}

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

3 participants