Open webnologie opened 4 years ago
use my plugin https://github.com/joshoconnor89/cordova-plugin-openwith
You can also test the latest version of the plugin. It is not yet released on npm so you have to install it with the following command:
cordova plugin add https://github.com/j3k0/cordova-plugin-openwith.git --variable ANDROID_MIME_TYPE="image/*" --variable IOS_URL_SCHEME=ccfoveaopenwithdemo --variable IOS_UNIFORM_TYPE_IDENTIFIER=public.image
I recently merged a PR with a lot of corrections regarding the plugin installation on IOS.
Feel free to give feedback.
I installed the latest version but there is a bug in iosAddTarget.js. if you add the platform for the first time you get the following error:
Error: ENOENT: no such file or directory, scandir '/Users/xxxxx/platforms/ios/ShareExtension'
this is the result of calling the function below BEFORE the "ShareExtension" dir is added at the platform var files = getShareExtensionFiles(context); // printShareExtensionFiles(files);
@dickverweij, Can you detail the command lines you use? I can't reproduce this error with the NPM version nor with the GIT version. Are you using the latest version of cordova?
$ cordova --version
9.0.0 (cordova-lib@9.0.1)
On the other hand, I strongly advise to use the GIT version via :
cordova plugin add https://github.com/j3k0/cordova-plugin-openwith.git --variable ANDROID_MIME_TYPE="image/*" --variable IOS_URL_SCHEME=ccfoveaopenwithdemo --variable IOS_UNIFORM_TYPE_IDENTIFIER=public.image
It has my last corrections concerning the installation on ios: https://github.com/j3k0/cordova-plugin-openwith/pull/97
@BenjaminPoncet
cordova -v 9.0.0 (cordova-lib@9.0.1)
We work with an automatic (devops) build system. This means everything is build cleanly:
"dependencies": { "cc.fovea.cordova.openwith": "git+https://github.com/j3k0/cordova-plugin-openwith.git",
we pull the lastest version from git
npm i .... cordova platform add ios --verbose
then we get this error:
Executing script found in plugin cc.fovea.cordova.openwith for hook "after_prepare": plugins/cc.fovea.cordova.openwith/hooks/iosAddTarget.js Adding target "cc.fovea.cordova.openwith/ShareExtension" to XCode project
Ok, if your build system requires you to configure the hooks manually you may need to make some updates:
<hook type="before_plugin_install" src="hooks/npmInstall.js" />
<hook type="before_prepare" src="hooks/iosCopyShareExtension.js" />
<hook type="after_prepare" src="hooks/iosAddTarget.js" />
<hook type="before_plugin_uninstall" src="hooks/iosRemoveTarget.js" />
The copy of the /Users/xxxx/platforms/ios/ShareExtension
directory is made by the before_prepare
hook.
another side effect of the new version is that the CODE_SIGN_ENTITLEMENTS property is overwritten in the project file (for the main target of the app)
Which old version are you referring to? Because nothing has changed on this point between version 2.0.0 and the last commits : https://github.com/j3k0/cordova-plugin-openwith/pull/97/files
Concerning the directory copy problem: Is it fixed?
regarding the directory copy problem: from cordova prepare ..
the hook "before prepare" is fired BEFORE the call from restore.installPluginsFromConfigXML.. thus the "before prepare" hook is never called..
return hooksRunner.fire('before_prepare', options)
.then(function () {
return restore.installPlatformsFromConfigXML(options.platforms, { searchpath: options.searchpath, restoring: true });
})
.then(function () {
options = cordova_util.preProcessOptions(options);
var paths = options.platforms.map(function (p) {
var platform_path = path.join(projectRoot, 'platforms', p);
return platforms.getPlatformApi(p, platform_path).getPlatformInfo().locations.www;
});
options.paths = paths;
}).then(function () {
options = cordova_util.preProcessOptions(options);
return restore.installPluginsFromConfigXML(options);
}).then(function () {
~
I managed to reproduce the problem. In fact, when the plugins directory doesn't exist, actually cordova downloads the plugins source codes on the fly during the prepare so between the before and after. I will integrate this case in my tests and fix it quickly. I also noticed that when the plugins are installed after the platform add, the "before_prepare" and "after_prepare" hooks are not executed, so the ShareExtention is not installed.
@BenjaminPoncet shall I submit a new issue for the CODE_SIGN_ENTITLEMENTS problem? My project main target has other entitlements (associated domains, etc) and those are overwritten by the new entitlements fix.
Yeah, new issue would be nice.
In the meantime, all fixes, you can use the npm version by modifying package.json
.
"dependencies": {
"cc.fovea.cordova.openwith": "^2.0.0"
},
hello, i still have a problem on ios. i think everything is configured correctly, but if i run the app on ios (12 and 13) first i get the native post-module with picture and text, after "post" it will not call my app, nothing happen. maybe you can help me. thank you