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] Support open with #1196

Closed
HarelM opened this issue Mar 30, 2020 · 16 comments
Closed

[iOS] Support open with #1196

HarelM opened this issue Mar 30, 2020 · 16 comments
Assignees
Labels
enhancement Medium Should be added/fixed in the future

Comments

@HarelM
Copy link
Member

HarelM commented Mar 30, 2020

Feature

Currently only Android supports open-with/share with due to CI limitation of the plugin that I have chose to use:
j3k0/cordova-plugin-openwith#82
So I'm adding this plugin only when building Android.
I have looked for an iOS only alternative and it seems that the other plugin has this issue too:
EternallLight/cordova-plugin-openwith-ios#23
And so I have written some comments and found out there's another fork that should work for iOS and Android and CI:
https://github.com/missive/cordova-plugin-openwith
I'll need to give it a go.

A few users have already encountered issues with the fact that this is not part of the app, which raises the priority of this issue.

@HarelM HarelM added enhancement Medium Should be added/fixed in the future labels Mar 30, 2020
@HarelM HarelM added this to the Next Release milestone Mar 30, 2020
@HarelM HarelM self-assigned this Mar 30, 2020
@HarelM
Copy link
Member Author

HarelM commented Mar 30, 2020

@EtienneLem Thanks for the info in the issue there.
I'll be happy to update the readme of your project with stuff that I find that are incorrect/confusing.
Let me know if you want a pull request or that I just write it here, I'll start here so I won't forget.
The first few comments:

  1. Installation can't be made using the following line:
    cordova plugin add cordova-plugin-openwith --variable IOS_URL_SCHEME=cordovaopenwithdemo as there's no plugin with this name in npm.
    Probably need a git source until this is released to npm.
  2. Also this part is confusing:
    "This is a bit modified version of cordova-plugin-openwith by Jean-Christophe Hoelt for iOS"
    Since you are using a fork of the cordova-plugin-openwith-ios I thought it doesn't support android although it is written there multiple times (it might just be me though).
  3. When installing with the suggested line above (and git) I'm getting: Failed to install 'cordova-plugin-openwith': Error: Variable(s) missing: IOS_BUNDLE_IDENTIFIER
    This error is clear, but the documentation should have the example with it
  4. I worked hard to get a lot of files working in Android, but I'm not sure how to do it on iOS, worth adding a file type in iOS and Android as an example, see my intent config here:
    https://github.com/IsraelHikingMap/Site/blob/master/IsraelHiking.Web/config.xml#L34
    I don't have a clue on how to translate it to iOS plist, but I guess I'll need to learn...
  5. My build still fails with the following error message:
fatal error: 'ShareViewController.h' file not found
#import "ShareViewController.h"

Which I think I had with the original plugin as well :-(
See here: j3k0/cordova-plugin-openwith#82
Build output can be seen here:
https://ci.appveyor.com/project/IsraelHikingHost/site/builds/31830135/job/05c7ump151duw7l6

@HarelM HarelM removed this from the Next Release milestone Apr 5, 2020
@HarelM
Copy link
Member Author

HarelM commented Apr 11, 2020

@EtienneLem any updates on this? I'm not sure what I'm doing wrong... :-(

@EtienneLem
Copy link

This is maybe fixed with missive/cordova-plugin-openwith@17008a8.

@HarelM
Copy link
Member Author

HarelM commented Apr 14, 2020

@EtienneLem Thanks for the update! I'll try to use the latest version you mentioned in a few days and report back here what had changed and if this was successful or not.
Thanks again!

@HarelM
Copy link
Member Author

HarelM commented Apr 16, 2020

@EtienneLem I have created another build with the latest changes in tour branch adn now I'm getting the following error:

error: "ShareExt" requires a provisioning profile with the App Groups feature. Select a provisioning profile in the Signing & Capabilities editor. (in target 'ShareExt' from project 'Israel Hiking Map')

Build can be found here:
https://ci.appveyor.com/project/IsraelHikingHost/site/builds/32231667/job/65e54xvaj8vewcsx

The relevant commit can be seen above and is only changing the package.lock file obviously.

@EtienneLem
Copy link

Right. Cordova really isn’t friendly with multi-targets. We are actually building the iOS app with Fastlane and can set the proper provisioning profiles that way.

So we use cordova prepare to initialize all the plugins / xcode, but instead of doing cordova compile, we use fastlane.

@HarelM
Copy link
Member Author

HarelM commented Apr 21, 2020

@EtienneLem I was hoping this is handled by the plugin code as well :-(
I was able to sign my app in appveyor CI (took me a while to get it right I must admit) and was hoping to avoid adding another dependency like fastlane.
Having said that, when I was researching the iOS app signing all the answers was to use fastlane, so I probably need to embrace the fact that I need another tool...
If you have an example repo that uses faslane let me know so I'll be able to reduce some of the effort of understanding what I need to configure in order to make fastlane up and running...

@HarelM
Copy link
Member Author

HarelM commented Jun 15, 2020

Fastlane on windows:
https://blog.vertica.dk/2019/08/15/automated-android-deployment-with-fastlane-on-windows/
Transporter on windows:
https://help.apple.com/itc/transporteruserguide/en.lproj/static.html#aria-apd28806d5ebc904
This is probably the next step in term of CI and local development...
Relevant issue for questions?
fastlane/fastlane#11687

@HarelM
Copy link
Member Author

HarelM commented Jul 23, 2020

@BenjaminPoncet I've took the latest code of the fovea open with plugin and I'm still getting the following error:

fatal error: 'ShareViewController.h' file not found
#import "ShareViewController.h"

Any chance you know how to overcome this?
Build log can be found here:
https://ci.appveyor.com/project/IsraelHikingHost/site/builds/34262543/job/6uakm64ae1eqxq4q
Relevant brach that is begin built is the fastlane-1266
Any help would be appreciated... I've been trying for a long time to make this work... :-((

@HarelM
Copy link
Member Author

HarelM commented Jul 26, 2020

@HarelM
Copy link
Member Author

HarelM commented Jul 26, 2020

@yuanjilee I saw a post on fastlane issue with what seems to be the same issue I'm facing. How did you manage to solve the problem? Are you using two provisioning profiles one for the app and the second one for the share extention? When I use two profiles I get a basically the problem described here:
https://stackoverflow.com/questions/55238974/bitrise-ionic-shareext-appex-requires-a-provisioning-profile#

HarelM added a commit that referenced this issue Jul 27, 2020
HarelM added a commit that referenced this issue Jul 30, 2020
HarelM added a commit that referenced this issue Oct 2, 2020
* Improve publishing mechanism using faslane #1266, [iOS] Support open with #1196

* [iOS] Support open with #1196 - Fix missing copy using an IHM fork

* [iOS] Support open with #1196 - Fix typo in provisioning file

* [iOS] Support open with #1196 - a different provisioning profile

* [iOS] Support open with #1196 - fix provisioning profile group id, added provisioning profile to build process

* [iOS] Support open with #1196 - change provisioning profile to be the same for both targets

* [iOS] Support open with #1196 - Fixed plugin code identity and style, changed provisioning profile back

* [iOS] Support open with #1196 - Fix quotes in package.json and plugin

* [iOS] Support open with #1196 - use same provisioning profile again...

* [iOS] Support open with #1196 - show options file content

* [iOS] Support open with #1196 - Updated some plugins and ios build tools

* [iOS] Support open with #1196 - move cat command to the right place

* [iOS] Support open with #1196 - Moved ios configuration to json file

* [iOS] Support open with #1196 - fix typo in build-ios file

* [iOS] Support open with #1196 - Fix issue with multipe provisioning profile in cordova-ios

* [iOS] Support open with #1196 - Added GPX file UTI and added subquery, removed fastlane

* [iOS] Support open with #1196 - Added cat to debug plist file

* [iOS] Support open with #1196 - changed to wild card plist

* [iOS] Support open with #1196 - fix cat call

* Restore web and android configurations, changed merged PR packages.

* Remove unwanted prints.

* Update certificate and provisioning profiles

* Fix provisioning profile mess

* #1266 - Fix provisioning profile, reduce build matrix

* #1266 - Fix provisioning profile uuid

* #1266 - Revert matrix build changes
@HarelM
Copy link
Member Author

HarelM commented Oct 2, 2020

Ok, so an initial commit was merged to master and now the plugin is used in the iOS build in my CI and it completes successfully. yay!
I still don't have a clue how to make it associate GPX files on iOS though... :-(
@EtienneLem @j3k0 @NiklasMerz if you guys can direct me how to do it it would be great as I'm pretty clueless when it comes to iOS, file association and the fact that all this needs to run in a CI server without human intervention...

@HarelM
Copy link
Member Author

HarelM commented Oct 23, 2020

According to a report from our Facebook group it seems that the app is now listed in some share options but does not open the file when selected.
I need to better understand how fix this.

@HarelM
Copy link
Member Author

HarelM commented Nov 6, 2020

@HarelM
Copy link
Member Author

HarelM commented Nov 9, 2020

This might be relevant for this issue:
https://github.com/apache/cordova-ios/issues/1020

@HarelM
Copy link
Member Author

HarelM commented Jan 5, 2021

Thanks for the info!
I ended up not using this plugin after all since the UX around it is not so good - i.e. the current plugin opens a dialog with an option to see an image you share and the plugin enforces only one type of file that can be used etc.
In the end, it seems that cordova already has some kind of mechanism to support opening files without any plugin and this is what I ended up using, along side webIntent in Android.
The problem when using this plugin in CI is that cordova-ios still does not support multiple provisioning profiles and this requires a fork I did for cordova-ios which was not merged unfortunately...
See issue #1391 for the complete solution and the relevant service code which utilizes both webIntent and cordova-ios build it handleOpenURL.
In my case it proved to be a simple and elegant solution that requires a lot less tinkering with xcode and post cordova build things which is very critical for me since I'm only releasing builds which were built on my CI and never release a build which I prepare locally.

Also I've talked with the guys that sent the following PR which solves some of the issues I've listed above:
missive/cordova-plugin-openwith#2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Medium Should be added/fixed in the future
Projects
None yet
Development

No branches or pull requests

2 participants