jcesarmobile / FilePicker-Phonegap-iOS-Plugin

This plugin makes possible to pick files from iCloud or other document providers
MIT License
50 stars 51 forks source link

Entitlements hook file with problems #48

Open allanpoppe opened 6 years ago

allanpoppe commented 6 years ago

If entitlements file exists, the hook stops running and never defers.

var destFile = path.join(iosFolder, projName, 'Resources', projName + '.entitlements');
if (fs.existsSync(destFile)) {
  console.error("File exists, not doing anything: " + destFile);
} else {

There are 2 problems here: 1 - The entitlements file can exist and don't have FilePicker necessary entitlements, created by another plugin; 2 - I think the hook must defer even if nothing was to be done, otherwise cordova platform add stops running after this.

I don't know what has to be done, I'm not familiar with hook nor entitlements logics.

jcesarmobile commented 6 years ago

Yeah, I was waiting for Cordova to switch to the usage of .entitlement files and use edit-config tag to write on it and remove the hook, but I should probably write in the current entitlement.plist files and remove the hooks

allanpoppe commented 6 years ago

@jcesarmobile https://cordova.apache.org/docs/en/latest/plugin_ref/spec.html#edit-config

An example:

        <edit-config file="*-Info.plist" mode="merge" target="NSCameraUsageDescription">
            <string>Você pode fazer upload de imagens através deste app.</string>
        </edit-config>

Isn't this what you're looking for? Note the mode 'merge'.

jcesarmobile commented 6 years ago

Yes, what I mean is, Cordova currently uses entitlement.plist files instead of the standard appName.entitlements. It was supposed to be changed, so I was waiting for it. But it's taking longer than expected, so I should probably just write in the entitlements.plist and update the plugin in the future if cordova-ios finally does the switch.

allanpoppe commented 6 years ago

Oh, I see. Sorry for my ignorance.

I think you should write in the entitlements.plist, indeed, even if we need to update it after Cordova changes. This could take forever, lol. This is giving me a hell of a headache, and I imagine others are struggling with this too.

I'm having to take another plugin (branch-cordova-sdk) from the config.xml before each time I run platftorm add, and reinsert it after. This is because it also uses the same entitlements file and writes in it before FilePicker does.

Thank you for your effort on this, this was the only real solution for picking files on iOS I could find. It would be awesome if you did this update.