{"action":"created","issue":{"url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/issues/1497","repository_url":"https://api.github.com/repos/phonegap/phonegap-plugin-push","labels_url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/issues/1497/labels{/name}","comments_url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/issues/1497/comments","events_url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/issues/1497/events","html_url":"https://github.com/phonegap/phonegap-plugin-push/issues/1497","id":198598097,"number":1497,"title":"App crashes after refreshing when using FCM (v2)","user":{"login":"AndreasGassmann","id":680814,"avatar_url":"https://avatars.githubusercontent.com/u/680814?v=3","gravatar_id":"","url":"https://api.github.com/users/AndreasGassmann","html_url":"https://github.com/AndreasGassmann","followers_url":"https://api.github.com/users/AndreasGassmann/followers","following_url":"https://api.github.com/users/AndreasGassmann/following{/other_user}","gists_url":"https://api.github.com/users/AndreasGassmann/gists{/gist_id}","starred_url":"https://api.github.com/users/AndreasGassmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndreasGassmann/subscriptions","organizations_url":"https://api.github.com/users/AndreasGassmann/orgs","repos_url":"https://api.github.com/users/AndreasGassmann/repos","events_url":"https://api.github.com/users/AndreasGassmann/events{/privacy}","received_events_url":"https://api.github.com/users/AndreasGassmann/received_events","type":"User","site_admin":false},"labels":[{"id":307723242,"url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/labels/android","name":"android","color":"BFD4F2","default":false},{"id":196374004,"url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"closed","locked":false,"assignee":{"login":"macdonst","id":353180,"avatar_url":"https://avatars.githubusercontent.com/u/353180?v=3","gravatar_id":"","url":"https://api.github.com/users/macdonst","html_url":"https://github.com/macdonst","followers_url":"https://api.github.com/users/macdonst/followers","following_url":"https://api.github.com/users/macdonst/following{/other_user}","gists_url":"https://api.github.com/users/macdonst/gists{/gist_id}","starred_url":"https://api.github.com/users/macdonst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macdonst/subscriptions","organizations_url":"https://api.github.com/users/macdonst/orgs","repos_url":"https://api.github.com/users/macdonst/repos","events_url":"https://api.github.com/users/macdonst/events{/privacy}","received_events_url":"https://api.github.com/users/macdonst/received_events","type":"User","site_admin":false},"assignees":[{"login":"macdonst","id":353180,"avatar_url":"https://avatars.githubusercontent.com/u/353180?v=3","gravatar_id":"","url":"https://api.github.com/users/macdonst","html_url":"https://github.com/macdonst","followers_url":"https://api.github.com/users/macdonst/followers","following_url":"https://api.github.com/users/macdonst/following{/other_user}","gists_url":"https://api.github.com/users/macdonst/gists{/gist_id}","starred_url":"https://api.github.com/users/macdonst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macdonst/subscriptions","organizations_url":"https://api.github.com/users/macdonst/orgs","repos_url":"https://api.github.com/users/macdonst/repos","events_url":"https://api.github.com/users/macdonst/events{/privacy}","received_events_url":"https://api.github.com/users/macdonst/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/milestones/8","html_url":"https://github.com/phonegap/phonegap-plugin-push/milestone/8","labels_url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/milestones/8/labels","id":1637068,"number":8,"title":"Release 2.0.0","description":"","creator":{"login":"macdonst","id":353180,"avatar_url":"https://avatars.githubusercontent.com/u/353180?v=3","gravatar_id":"","url":"https://api.github.com/users/macdonst","html_url":"https://github.com/macdonst","followers_url":"https://api.github.com/users/macdonst/followers","following_url":"https://api.github.com/users/macdonst/following{/other_user}","gists_url":"https://api.github.com/users/macdonst/gists{/gist_id}","starred_url":"https://api.github.com/users/macdonst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macdonst/subscriptions","organizations_url":"https://api.github.com/users/macdonst/orgs","repos_url":"https://api.github.com/users/macdonst/repos","events_url":"https://api.github.com/users/macdonst/events{/privacy}","received_events_url":"https://api.github.com/users/macdonst/received_events","type":"User","site_admin":false},"open_issues":10,"closed_issues":5,"state":"open","created_at":"2016-03-10T17:05:14Z","updated_at":"2017-01-05T02:55:41Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2017-01-03T23:45:56Z","updated_at":"2017-01-05T14:21:18Z","closed_at":"2017-01-05T02:55:41Z","body":"I have an Ionic2 app and I'm using the v2 branch of this plugin to use FCM push notifications. I noticed that the app crashes when refreshing it using safari. My initial thought was to only call the .init() method after the first launch, but according to the docs the registrationId might change and it should be called on every app launch.\r\n\r\nAfter reading a bit on stackoverflow, it might be related to this issue: http://stackoverflow.com/questions/37910766/app-crashing-when-using-firebase-auth-reason-default-app-has-already-been-con\r\n\r\nMaybe it could be fixed with the following snippet:\r\n\r\n```\r\n    // Configure Firebase\r\n    // ------------------\r\n    if FIRApp.defaultApp() == nil {\r\n        FIRApp.configure()            \r\n    }\r\n```\r\n\r\n### Expected Behaviour\r\n\r\nWhen refreshing the app, I expect the app to work normally and the push registration to succeed (or be skipped)\r\n\r\n### Actual Behaviour\r\n\r\nThe app crashes after refreshing\r\n\r\n#### Steps to Reproduce \r\n\r\nBuild and run app using FCM and v2 from XCode\r\nWait for the registration to go through (without any errors)\r\nOpen Safari Dev Tools\r\nRefresh the Page\r\nApp will load but crash once it tries to register again\r\n\r\n#### Platform and Version (eg. Android 5.0 or iOS 9.2.1)\r\n\r\niOS 10.1\r\n\r\n#### Cordova CLI version and cordova platform version\r\n\r\n    cordova --version: 6.4.0\r\n    cordova platform version ios: 4.3.1\r\n\r\n#### Plugin version\r\n\r\n    cordova plugin version | grep phonegap-plugin-push: 2.0.0-rc1 \"PushPlugin\"\r\n\r\n#### Logs taken while reproducing problem\r\n\r\n```2017-01-04 00:06:36.083081 App[xxx] Push Plugin register called\r\n2017-01-04 00:06:36.083123 App[xxx] PushPlugin.register: setting badge to false\r\n2017-01-04 00:06:36.083136 App[xxx] PushPlugin.register: clear badge is set to 0\r\n2017-01-04 00:06:36.083146 App[xxx] PushPlugin.register: better button setup\r\n2017-01-04 00:06:36.090700 App[xxx] FCM Sender ID xxx\r\n2017-01-04 00:06:36.090921 App[xxx] Using FCM Notification\r\n2017-01-04 00:06:36.103581 App[xxx] *** Terminating app due to uncaught exception 'com.firebase.core', reason: 'Default app has already been configured.'\r\n*** First throw call stack:\r\n(0x1842221c0 0x182c5c55c 0x184222108 0x10027e430 0x10027e1f8 0x100215118 0x100ec525c 0x100ec521c 0x100eca284 0x1841cff2c 0x1841cdb18 0x1840fc048 0x185b82198 0x18a0e72fc 0x18a0e2034 0x1000e90e4 0x1830e05b8)\r\nlibc++abi.dylib: terminating with uncaught exception of type NSException```\r\n\r\nThe error happens at [FIRApp configure]; on line 333 in the following file: https://github.com/phonegap/phonegap-plugin-push/blob/v2.0.x/src/ios/PushPlugin.m "},"comment":{"url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/issues/comments/270654509","html_url":"https://github.com/phonegap/phonegap-plugin-push/issues/1497#issuecomment-270654509","issue_url":"https://api.github.com/repos/phonegap/phonegap-plugin-push/issues/1497","id":270654509,"user":{"login":"macdonst","id":353180,"avatar_url":"https://avatars.githubusercontent.com/u/353180?v=3","gravatar_id":"","url":"https://api.github.com/users/macdonst","html_url":"https://github.com/macdonst","followers_url":"https://api.github.com/users/macdonst/followers","following_url":"https://api.github.com/users/macdonst/following{/other_user}","gists_url":"https://api.github.com/users/macdonst/gists{/gist_id}","starred_url":"https://api.github.com/users/macdonst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macdonst/subscriptions","organizations_url":"https://api.github.com/users/macdonst/orgs","repos_url":"https://api.github.com/users/macdonst/repos","events_url":"https://api.github.com/users/macdonst/events{/privacy}","received_events_url":"https://api.github.com/users/macdonst/received_events","type":"User","site_admin":false},"created_at":"2017-01-05T14:21:18Z","updated_at":"2017-01-05T14:21:18Z","body":"@AndreasGassmann releasing a 2.0.0-rc2 now."}}
{"actor":{"display_login":"macdonst"}}