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: App will not called after post #95

Open
webnologie opened this issue Feb 26, 2020 · 12 comments
Open

iOS: App will not called after post #95

webnologie opened this issue Feb 26, 2020 · 12 comments

Comments

@webnologie
Copy link

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

@joshoconnor89
Copy link

@BenjaminPoncet
Copy link
Collaborator

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.

@dickverweij
Copy link

dickverweij commented Mar 27, 2020

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);

@BenjaminPoncet
Copy link
Collaborator

@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 ([email protected])

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: #97

@dickverweij
Copy link

@BenjaminPoncet

cordova -v
9.0.0 ([email protected])

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

  • Folder containing your iOS project: /Users/xxxx/platforms/ios/
    Parsing existing project at location: /Users/xxxx/platforms/ios/XXXXX.xcodeproj/project.pbxproj...
    Error: ENOENT: no such file or directory, scandir '/Users/xxxx/platforms/ios/ShareExtension'

@BenjaminPoncet
Copy link
Collaborator

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.

@dickverweij
Copy link

dickverweij commented Mar 30, 2020

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)

@BenjaminPoncet
Copy link
Collaborator

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?

@dickverweij
Copy link

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 () {

~

@BenjaminPoncet
Copy link
Collaborator

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.

@dickverweij
Copy link

@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.

@BenjaminPoncet
Copy link
Collaborator

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"
  },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants