Open dickverweij opened 4 years ago
I think it comes from running iosAddTarget.js on the after_prepare hook.
By fixing the problem you noticed here: https://github.com/j3k0/cordova-plugin-openwith/issues/95 I revert to the after_plugin_install hooks (with some other fixes).
Before PR, could you test my branch:
"dependencies": {
"cc.fovea.cordova.openwith": "git+https://github.com/BenjaminPoncet/cordova-plugin-openwith.git#ios-fix-shareext-install"
},
I hope this fixes both your problems at the same time!
@BenjaminPoncet i tested your branch, now no more errors in cordova platform add ios... but.. after the command the project file does not contain the share extension. I think cordava modifies the project file in the prepare step and removes it.
during this breakpoint the project file does contain the share extension target..
at this breakpoint the project file the share extension target is gone
My bad! I checked that all hooks were well executed in all cases but I did not check again that the ShareExtention was present in the xcode project. Thanks for the input, I think I'm very close.
@dickverweij, Got it! Everything should work out in your case. I also rewrote the addition of the entitlment to avoid overwriting. It's all on my branch.
almost @BenjaminPoncet .. it is now without erors. but.. there was a reason you did a "after_prepare" step in the first place.
in the prepare step cordova overwrites the PRODUCT_BUNDLE_INDENTIFIER of the ShareExt target .. :-(
Really!? Good point! Cordova really doesn't like multi-target projects...
In a first one, I had switched to the prepare hooks but not especially for the PRODUCT_BUNDLE_INDENTIFIER but simply by thinking that those are the hooks that cover more usage. By reworking the hooks, I tried to be less global and closer to the uses.
I just rebase my branch to keep the after_prepare hook!
However, during my tests, I noticed that by executing the cordova prepare
command without ios
, cordova rewrites the PRODUCT_BUNDLE_INDENTIFIER but doesn't execute the hooks specific to ios...
I have the feeling that this is a bug and that it would be enough to trigger the iosAddTarget.js (or a new hook) globally but well, it's starting to annoy me!
Any advice?
Advice ? :-) The cordava build system (next to the NPM package hell) is really a beast on its own. Now that we automated our ionic IOS and android builds (with auto publish to testflight) we have to be sure what is going on under the hood. If a plugin fails it can fail the complete build afterwards. Certain hooks can mess things up you just corrected in another. Your plugin also creates a multi target xcode project.. yep Cordova really does not like multi target stuff.. :-) We had the write a patch for the exportOptions.. My advice is never asume this is the only plugin in a typical ionic project. If your plugin has side-effects be sure that they dont affect other targets..
@dickverweij can you please share the patch that you did that worked for you?
In your latest change "CODE_SIGN_ENTITLEMENTS" are set in the project for every build target of the project.
This is fine for the ShareExt target, but not for the other targets in the project. It basically overwrties all previously stored settings for those targets (for example push notification entitlements or associated domains)
It should inject the ShareExt app group setting into the entitlements and leave other settings intact.