Open sky-love opened 4 years ago
I'm also getting a similar issue when trying to share an image on Instagram. @ionic-native/social-sharing
, which uses cordova-plugin-x-socialsharing
works for Facebook and Twitter in iOS 14, but I found that Instagram only works up until iOS 12.
I also attempted to use cordova-instagram-plugin
to try and open Instagram with the Instagram.share
function. This requires a base64 image as a parameter, and I have tried to convert the image to base64 with cordova-plugin-camera
and other methods, but I have not gotten the plugin to open Instagram either.
Here is ionic info
:
Ionic CLI : 5.4.16
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.4
Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : none
Cordova Plugins : cordova-plugin-ionic 5.2.1, cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 2.5.3, (and 18 other plugins)
cordova-res (update available: 0.15.1) : 0.14.1
native-run : 1.0.0
NodeJS : v10.16.0 (/Users/gabepetersen/.nvm/versions/node/v10.16.0/bin/node)
npm : 6.14.6
OS : macOS Catalina
Here is a snippet of package.json
:
"@ionic-native/instagram": "^4.20.0",
"@ionic-native/camera": "^4.20.0",
"@ionic-native/social-sharing": "^4.20.0",
"cordova-plugin-camera": "4.0.3",
"cordova-instagram-plugin": "^0.5.8",
"cordova-plugin-x-socialsharing": "^5.6.5",
Here is also a function for choosing an image from the camera roll and sharing it with the Instagram plugin. (I believe this is the correct structure, but it is not working):
public shareInstagram() {
// check if instagram is installed
this.instagram.isInstalled().then((installed) => {
if(installed) {
console.log("Instagram Installed");
} else {
console.log("Instagram not installed on Device");
}
return installed;
}).then((installed) => {
if(installed) {
const options: CameraOptions = {
quality: 50,
sourceType: this.camera.PictureSourceType.PHOTOLIBRARY,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE,
}
this.camera.getPicture(options).then((imageData) => {
// use base64 string to share to instagram
this.instagram.share(imageData).then(() => {
console.log("Shared!");
}).catch((error: any) => {
console.error(error);
});
}).catch((err) => {
console.log("Could not get picture for instagram", err);
});
}
})
}
I hope this can help get the issue more recognition. :)
I was having trouble sharing to Instagram on iOS, and narrowed it down to two issues:
LSApplicationQuerySchemes
so that instagram
didn't end up in my app's plist file. This is why I was getting the "Open the Instagram app and login to share this post" message; the instagram
scheme wasn't whitelisted, even though I followed this plugin's documentation to whitelist it. You can check if this is your issue by examining platforms/ios/<YourAppName>/<YourAppName>-Info.plist
and confirming whether instagram
is present under LSApplicationQuerySchemes
. I wrote this script to fix the plist file.Interestingly, now when I use this call to share "window.plugins.socialsharing.share" and I click on the IG icon, the dialog appears and I am able to post my image... window.plugins.socialsharing.shareViaInstagram still doesn't do anything.
I haven't updated my iOS (13.3) or anything. The only thing I did was to update SocialSharing plugin to version 6.0 beta. (cordova-plugin-x-socialsharing@6.0.0). 5.8 was making XCODE throw a lot of deprecated warnings..
Any fix ever developed for this?
Looks like sharing to Instagram is an issue on iOS for this plugin. I followed all the tips and still can't get IG to open on iOS 13. I see the icon on the list but it always prompts me to open the app separately which is missing the whole point as the user would have to save the image to their device first. Everything else works well.
window.plugins.socialsharing.shareViaInstagram - doesn't do anything
and the only way I can even show the IG icon is via this call:
window.plugins.socialsharing.share(null, null, 'www/images/png/pic.jpg', null);
Can anyone help?
(Is it me or is it that most of Cordova plugins seem outdated and unsupported? Most of the 5200 or so plugins on Cordova site is just pure junk, and this one is the ONLY workable social share plugin I could find! (scary) Cordova is a great platform for a web designer to make his first app but it seems like an old dying dinosaur. Is there anything else out there?)