I’m using an Ionic 3 app, trying to get social sharing working.
I followed the steps to install the Ionic Native Social Sharing plugin from: https://ionicframework.com/docs/v3/native/social-sharing/
Ran:
$ ionic cordova plugin add cordova-plugin-x-socialsharing
$ npm install --save #ionic-native/social-sharing#4
Imported the plugin (version 4.x.x) via my app module and added SocialSharing to the providers array.
Imported the plugin via my app.component using:
import { SocialSharing } from '#ionic-native/social-sharing';
Added to the constructor:
private socialSharing: SocialSharing
This share function, also in app.component is triggered via a button in the html (side menu):
async share() {
try {
// Pop the native social sharing sheet, allowing the user to choose how to share the app.
await this.socialSharing.share(this.shareMessage, this.shareSubject, this.shareFile, this.getShareUrl());
this.toast.show('Thanks for sharing!', 3000);
}
catch(err) {
console.error(err);
alert(err);
}
}
I’m using platforms: ios, android and browser.
When I call the method from a build on a real device I get the error:
"Plugin is not installed"
Tried:
Checking logs for installation errors. None seen.
Reinstalled plugin.
Checked plugin present using $ionic cordova plugin list. cordova-plugin-x-socialsharing 5.4.7 “SocialSharing” is present.
Removed and added all platforms again.
Wrapped the share method inside a platform.ready().
Nothing seems to be working. I cannot get the app to recognise the plugin is installed!
PLEASE HELP! :slight_smile: What can I try next?
Thanks
$ionic info:
Ionic:
Ionic CLI : 5.2.3 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.5
#ionic/app-scripts : 3.2.2
Cordova:
Cordova CLI : 9.0.0 (cordova-lib#9.0.1)
Cordova Platforms : android 8.0.0, browser 6.0.0, ios 5.0.1
Cordova Plugins : cordova-plugin-ionic 5.4.0, cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.5.1, (and 13 other plugins)
Utility:
cordova-res : 0.4.0 (update available: 0.6.0)
native-run : not installed
System:
ios-deploy : 1.9.4
ios-sim : 8.0.2
NodeJS : v11.2.0 (/usr/local/Cellar/node/11.2.0/bin/node)
npm : 6.9.2
OS : macOS Mojave
Xcode : Xcode 10.2 Build version 10E125
So according to your information your current installed plugin is version 5.4.7, to make plugins work with Ionic 3 you need to ensure you have installed 4.* version of the plugin.
Seems like you are using the right command for the install (adding #4 after the plugin install command).
Can you try uninstall the plugin and then attempt to reinstall and note which version its installing. You may have to try and install 4.* version:
npm install --save #ionic-native/social-sharing#4.12.0
I got an issue with cordova-plugin-x-socialsharing in Ionic3 and main issue was couldn't install cordova-plugin-x-socialsharing plugin properly(error: can't find plugin.xml for es6-promise-plugin).
Steps to fix:
Installed es6-promise-plugin : ionic cordova plugin add https://github.com/vstirbu/PromisesPlugin
Installed cordova-plugin-x-socialsharing : ionic cordova plugin add cordova-plugin-x-socialsharing
npm install --save #ionic-native/social-sharing#4
Related
I met a problem for 3 days with my application ionic 3.
In fact, after builder in prod and release mode, it is always the old version that is always taken into account. the changes do not reflect.
So when mode debug, the changes are well taken.
I tried several solutions may nothing.
Ionic v3
Also i have tried many solutions but no changes
ionic cordova platforms rm android
ionic cordova platforms add android
ionic cordova build android --prod --release --aot
------------no change-------------
I have downgrade the app-scripts version always same
i have delete the www folder and run ionic serve --lab after i run build commande still no change
I need help.
Thanks you in advance
Ionic:
Ionic CLI : 5.2.3
Ionic Framework : ionic-angular 3.9.2
#ionic/app-scripts : 3.1.8
Cordova:
Cordova CLI : 8.1.2 (cordova-lib#8.1.1)
Cordova Platforms : android 7.1.4, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic 3.1.2, cordova-plugin-ionic-webview 1.2.1, (and 18 other plugins)
Utility:
cordova-res : 0.6.0
native-run : 0.2.8
System:
Android SDK Tools : 26.1.1 (C:\Sdk)
NodeJS : v10.15.1 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 10
Build pass successfully
remove android platform using
ionic cordova platform rm android remove manually node-modules and
package-lock.json (imp*)
Unistall old Application
npm cache clean --force
finally run npm install
ionic cordova platform add android
ionic cordova build android
As #MD Khali said to remove the platform and add platform again, but if it happens after that you just need to click save 3-4 time. Because I have the same problem in my ionic 3 projects.
Finally I found the solution.
The problem was related to the ionic plugin (appflow).
I had two choices
1. Generate the apk from the appflow platform with the configured branch.
Remove the ionic plugin applflow
I took the choice 1.
Documentation of appflow https://ionicframework.com/appflow
I am trying to create an ipa file but I have this unreadable error
when I run this command line on my Mac
ionic cordova build ios --prod --release
CordovaError: Promise rejected with non-error: 'Error code 65 for
command: xcodebuild with args:
-exportArchive,-archivePath,MyApp.xcarchive,-exportOptionsPlist,/Users/FSE/myApp04/platforms/ios/exportOptions.plist,-exportPath,/Users/FSE/myApp04/platforms/ios/build/device'
at cli.catch.err (/usr/local/lib/node_modules/cordova/bin/cordova:30:15)
at process.internalTickCallback (internal/process/next_tick.js:77:7)
Ionic:
ionic (Ionic CLI) : 4.3.0 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
#ionic/app-scripts : 3.2.0
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib#8.1.1)
Cordova Platforms : ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.2.0, (and 4 other plugins)
System:
ios-deploy : 1.9.4
NodeJS : v11.0.0 (/usr/local/bin/node)
npm : 6.4.1
OS : macOS
Xcode : Xcode 10.1 Build version 10B61
I've solved it like this
ionic cordova build ios -- --buildFlag="-UseModernBuildSystem=0"
The accepted answer is correct. You can also put in build.json file:
{
"ios": {
"release": {
...,
"buildFlag": [
"-UseModernBuildSystem=0"
]
}
}
}
either
ionic cordova build ios -- --buildFlag="-UseModernBuildSystem=0"
or just open
xcode -> File -> Workspace Settings
and change build system to "Legacy Build System"
In my experience the "buildFlag" is not enough, I mean I had:
"ionic cordova run ios -- --buildFlag=\"-UseModernBuildSystem=0\""
... but I was still getting the Error code 65.
To solve the issue you must open the project you find inside "yourproject/platforms/ios" in xcode and check that the signing certificate is ok. To do so just click on the project (first icon on the top-left panel) and check the "Signing" section.
For newer version of xcode, you have to have Legacy Build System. If you already have the Legacy Build System, then uncheck the automatic signing and recheck it. Don't know why but it worked for me.
I am facing this issue when running in browser mode. How can I solve this? Would be possible to open this dialog in a new tab instead of an iFrame?
https://github.com/EddyVerbruggen/cordova-plugin-googleplus
Many thanks for the help!
Using Ionic with following settings:
cordova-plugin-googleplus 5.3.2 "Google SignIn"
Ionic:
ionic (Ionic CLI) : 4.0.5 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
#ionic/app-scripts : 3.2.0
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 7.0.0, browser 5.0.4, ios 4.5.5
System:
NodeJS : v8.11.3 (/usr/local/bin/node)
npm : 5.6.0
OS : macOS High Sierra
Xcode : Xcode 10.0 Build version 10A255
Try removing the cordova-plugin-inappbrowser plugin.
Coexist with inAppBrowser plugin (fixed)
Some plugins can only be tested/working inside a device.
I remember that the google+ sign need to use the google play services and the apk signature those things aren't available running in local browser with chrome.
It's likely you test the android push notifications with the chrome it won't work.
For these type of things better if you call the ionic with the live reload to test in the device and reload when you make changes
ionic cordova run android -l -c
I upgraded lately to ionic 3, in my new project i use custom font when i use ionic serve it copy the fonts from src/assets/fonts to www/assets and it works well.
But when i run it on android using ionic cordova run android the font files inside www/assets disappears and it run on my device with no fonts.
my ionic info:
#ionic/cli-utils : 1.9.2
ionic (Ionic CLI) : 3.9.2
global packages:
Cordova CLI : 7.0.1
local packages:
#ionic/app-scripts : 2.1.3
Cordova Platforms : android 6.2.3
Ionic Framework : ionic-angular 3.6.0
System:
Android SDK Tools : 25.2.5
Node : v6.10.3
npm : 3.10.10
OS : Windows 10
It is something weird with the latest version of ionic cli 3.9.2 or webpack (not sure). Fonts with WOFF extensions only are copied
I tried using WOFF format instead of TTF and it works.
You should be placing the asset into your WWW folder before the build.
if you add a fonts folder to your www it should place it in your platforms when you add the platforms and emulate, if not you will need to add the font to your platforms folder for it to emulate and be in your builds
yourapp/platforms/android(or ios)/assets/www/font
try running ionic cordova build android before running ionic cordova run android.
I try to use video.js as my video player, but reaches error:
Uncaught (in promise): Error: Cannot find module "safe-json-parse/tuple" Error: Cannot find module "safe-json-parse/tuple"
Steps I did:
npm install -S video.js
import videojs from 'video.js';
write code in palyer.ts => videojs('my-player', { controls: true});
above error appears when player page is hit.
Anybody has any idea? Or what other 3rd party html5 video player can be easily plugged in?
environment details:
ionic info
global packages:
#ionic/cli-utils : 1.4.0
Cordova CLI : 7.0.1
Ionic CLI : 3.4.0
local packages:
#ionic/app-scripts : 1.3.7
#ionic/cli-plugin-cordova : 1.4.0
#ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms : android 6.2.3
Ionic Framework : ionic-angular 3.3.0
System:
Node : v6.10.3
OS : Linux 4.10
Xcode : not installed
ios-deploy : not installed
ios-sim : not installed
npm : 3.10.10
I did the same thing, I had a safe-json-parse module so thought I was fine, but after doing:
npm install -s safe-json-parse
new files were added and the error was gone.
I downloaded the videojs js and css files to assets/ folder and references them in index.html.
By this way videojs works, though not as elegant as with npm package