Mark Veenstra created CB-14264:
----------------------------------

             Summary: The file “embedded.mobileprovision” couldn’t be opened 
because there is no such file.
                 Key: CB-14264
                 URL: https://issues.apache.org/jira/browse/CB-14264
             Project: Apache Cordova
          Issue Type: Bug
          Components: cordova-ios
            Reporter: Mark Veenstra


The widely used plugin `phonegap-plugin-push` includes the Firebase iOS SDK for 
push messaging with iOS through FCM. But if you want to use a debug build which 
using the development certificates it currently thows the following error:
{code:java}
2018-08-09 11:05:48.622602+0200 MyApp[760:240424] 4.13.0 - 
[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/F8B23BB0-4A1E-42AA-9430-47867B80827A/MyApp.app/embedded.mobileprovision,
 NSUnderlyingError=0x2811b29a0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such 
file or directory"}}
{code}
This error is thrown by Firebase 
[here|https://github.com/firebase/firebase-ios-sdk/blob/master/Firebase/Auth/Source/FIRAuthAPNSTokenManager.m#L160].

This is because this file is removed by the file [`copy-www-build-step.js`on 
line 
56|https://github.com/apache/cordova-ios/blob/master/bin/templates/scripts/cordova/lib/copy-www-build-step.js#L56].
 If we comment out this line, al works like a charm and we can use the debug 
release to test push messages through FCM.

If we take a look at Firebase iOS SDK it states [`If the app does not contain 
the embedded.mobileprovision which is stripped out by Apple when the app is 
submitted to store, then it is highly likely that it is from Apple 
Store.`|https://github.com/firebase/firebase-ios-sdk/blob/master/GoogleUtilities/Environment/third_party/GULAppEnvironmentUtil.m#L176].
 
Which means that if `cordova-ios` removes this file as it does Firebase expects 
it to be a release build, which is incorrect and the error is thrown and you 
will not receive a correct FCM token for debug purposes.

So for the moment we created a hook that comments out the removal of 
`embedded.mobileprovision` after platform add. Now all works like a charm. But 
the main question is, should it be removed? Or how can we make sure Firebase 
iOS SDK will not mark it as production without that file? 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to