Skip to content
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

iOS on FCM not working for debug signed apps + workaround #2518

Open
laagland opened this Issue Aug 9, 2018 · 12 comments

Comments

Projects
None yet
@laagland
Copy link
Contributor

laagland commented Aug 9, 2018

Expected Behaviour

When configuring iOS on FCM notifications for debug-signed apps should arrive.

Actual Behaviour

Sending notifications gives a 'InvalidRegistration' error and when attempted a second time with the same FCM token, a 'NotRegistered' error.

Steps to Reproduce

We use separate debug & production versions of our apps.
When using a debug-only version, we couldn't get notifications delivered to our client apps.

Using the debugger in Xcode, we noticed the following error from Firebase:

[Firebase/InstanceID][I-IID003014] Error while reading embedded mobileprovision Error Domain=NSCocoaErrorDomain Code=260 "The file “embedded.mobileprovision” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/var/containers/Bundle/Application/XXX/embedded.mobileprovision, NSUnderlyingError=0x28127d620 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

It turns out that Cordova uses a hook during the ios-build, which removes the embedded.mobileprovision that Firebase uses to determine if this is a production app or not. Because this is missing, debug-only signed apps will not receive the correct FCM token when the plugin makes a request to Firebase.

A workaround is to comment out the line to prevent the removal of the file during the debug build (line 56 in platforms/ios/cordova/lib/copy-www-build-step.js).
An issue was created to fix this in cordova, see https://issues.apache.org/jira/browse/CB-14264

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

iOS 12 on iPhone & iPad

Cordova CLI version and cordova platform version

cordova-cli 8.0
cordova-ios 4.5.5

Plugin version

phonegap-plugin-push v2.2.3

@mark-veenstra

This comment has been minimized.

Copy link

mark-veenstra commented Aug 9, 2018

A workaround is to comment out the line to prevent the removal of the file during the debug build (line 56 in platforms/ios/cordova/lib/copy-www-build-step.js).

This could be done by added a hook to the plugin which will execute after platform add and or removes the line or comments it out

@macdonst macdonst added bug ios labels Aug 9, 2018

@macdonst

This comment has been minimized.

Copy link
Member

macdonst commented Aug 9, 2018

@laagland let's vote up the cordova issue so it gets fixed. I just voted and started watching it.

@ecert

This comment has been minimized.

Copy link

ecert commented Oct 2, 2018

Hi there,
Cordova project on Xcode10 is failure for FCM because of XCode's new build system.

If you want to use Google FCM Push Notification with iOS device (Coding with Cordova / Ionic 3) try this; Opening your cordova/ionic project in the Xcode IDE and change the build system in Workspace Settings to "Legacy Build System". (Under the File Menu)

@egantz

This comment has been minimized.

Copy link

egantz commented Oct 3, 2018

@ecert works perfectly! So now we need to wait for a fix in order to return back to the new build system?

@Vikum94

This comment has been minimized.

Copy link

Vikum94 commented Oct 14, 2018

Hi there,
Cordova project on Xcode10 is failure for FCM because of XCode's new build system.

If you want to use Google FCM Push Notification with iOS device (Coding with Cordova / Ionic 3) try this; Opening your cordova/ionic project in the Xcode IDE and change the build system in Workspace Settings to "Legacy Build System". (Under the File Menu)

This worked for me with ionic 3.9. Thanks for the fix (y) @ecert

@mark-veenstra

This comment has been minimized.

Copy link

mark-veenstra commented Oct 15, 2018

Seems to me that the XCode 10 issue is a different kind of issue then the one we are focusing on here.

@egantz

This comment has been minimized.

Copy link

egantz commented Oct 15, 2018

Hi there,
Cordova project on Xcode10 is failure for FCM because of XCode's new build system.

If you want to use Google FCM Push Notification with iOS device (Coding with Cordova / Ionic 3) try this; Opening your cordova/ionic project in the Xcode IDE and change the build system in Workspace Settings to "Legacy Build System". (Under the File Menu)

It's actually fixes the issue with iOS12 but breaks any previous version of iOS.

@2mia

This comment has been minimized.

Copy link

2mia commented Oct 21, 2018

image

I confirm commenting out ☝️ line 56 fixed FCM pushes for debug builds.

@assafshp

This comment has been minimized.

Copy link

assafshp commented Oct 21, 2018

@2mia it's also works for me !!!! many thanks !

@clairepat

This comment has been minimized.

Copy link

clairepat commented Nov 21, 2018

Y’all have no idea just how much I love all the work you’re doing on my behalf and I plan to compensate you accordingly. I hope I haven’t undone anything but.... I uninstalled BitPay and reinstalled it and it should be brand new. I’m going to do the same with Copay and Bitcore on both devices then reinstall like they’re brand new. I’ll encrypt both as directed. So far as I can tell, they’re both been completely empty of anything deposited. Jesus, I’ll feel awful if I screwed up anything. i check activity logs, I see entries but in the end everything’s empty. I understand it’s totally not your fault. I’ll wait for advice whether I need to keep my poorly informed paws off the apps until further notice. I’m desperately trying to find catpat15@gmail.com. I signed up under ProtonMail for halh a day until somebody from support finally got back to me. My question was “Is a secure email service really secure on a jailbroken phone?” The response? A stunning “I don’t understand your question. Why would you allow someone to jailbreak your phone in the first place?” That put my needle in the red and I almost unloaded on him with an epithet laced sortie of insults. Instead, I simply told the writer, if you’re incapable of understanding a direct question, then presume to infer I actually allowed someone to jailbreak my phone, I don’t expect we’re ever going to have a working relationship. I’m uninstalling this app as soon as this conversation is over. As far as I’m concerned, it is over, right now. Thank you for being unable to understand anything. I didn’t mean to go off on that rant but I told Dillon that would be my new email, but I’m not sure he ever received it. The site is not user friendly and I’ve no idea how it really works. I suppose I’ll have to take my husband’s advice and buy “In The Beginning.....Was Command Line” I have almost nine grand in my queue at the Apple Store. If I have that muck in anything, the sooner I can actually have hardware to do my part of the coding. If I’ve understood anything I’ve read. I also have questions about my repos. I have no idea what I have or what to do with it. I don’t mind making a bunch of repos, I mean at least until I die. That should keep Dillon busy for the next 20 years or so. Then, okay, I honestly didn’t expect an army of coders working on my behalf. I do, however love Gamboster for seeing something was really screwed up. Before I uninstall I’ll try recovery and see what happens, if I can find my pass phrases. I have very poor password hygiene. I’m reminded of that frequently. Thanks so much, let’s just go back to y’all. 😍

@olaferlandsen

This comment has been minimized.

Copy link

olaferlandsen commented Nov 27, 2018

Hi there,
Cordova project on Xcode10 is failure for FCM because of XCode's new build system.

If you want to use Google FCM Push Notification with iOS device (Coding with Cordova / Ionic 3) try this; Opening your cordova/ionic project in the Xcode IDE and change the build system in Workspace Settings to "Legacy Build System". (Under the File Menu)

So go to:

Xcode > File > Workspace Settings...

@rakeshpalivela

This comment has been minimized.

Copy link

rakeshpalivela commented Feb 5, 2019

Hi there,
Cordova project on Xcode10 is failure for FCM because of XCode's new build system.

If you want to use Google FCM Push Notification with iOS device (Coding with Cordova / Ionic 3) try this; Opening your cordova/ionic project in the Xcode IDE and change the build system in Workspace Settings to "Legacy Build System". (Under the File Menu)

This working for me in Xcode 10.1. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.