无法使用cordova-plugin-x-socialsharing共享文件

无法使用cordova-plugin-x-socialsharing共享文件,cordova,ionic-framework,ionic2,ionic3,ionic-native,Cordova,Ionic Framework,Ionic2,Ionic3,Ionic Native,我正在尝试使用cordova-plugin-x-socialsharing共享备份文件*.bkp 在我的爱奥尼亚项目中,使用任何文件管理器都可以成功地共享文件。但是在内部使用myapp失败了 我已经试过了 我的目标是通过shareitapp或messenger作为附件共享到文件 这是我的Package.json { "name": "ionic-hello-world", "version": "0.0.0", "author": "Ionic Framework",

我正在尝试使用cordova-plugin-x-socialsharing共享备份文件
*.bkp
在我的爱奥尼亚项目中,使用任何文件管理器都可以成功地共享文件。但是在内部使用myapp失败了

我已经试过了

我的目标是通过shareitapp或messenger作为附件共享到文件

这是我的Package.json

{
    "name": "ionic-hello-world",
    "version": "0.0.0",
    "author": "Ionic Framework",
    "homepage": "http://ionicframework.com/",
    "private": true,
    "scripts": {
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build",
        "lint": "ionic-app-scripts lint",
        "ionic:build": "ionic-app-scripts build",
        "ionic:serve": "ionic-app-scripts serve"
    },
    "dependencies": {
        "@angular/common": "4.1.3",
        "@angular/compiler": "4.1.3",
        "@angular/compiler-cli": "4.1.3",
        "@angular/core": "4.1.3",
        "@angular/forms": "4.1.3",
        "@angular/http": "4.1.3",
        "@angular/platform-browser": "4.1.3",
        "@angular/platform-browser-dynamic": "4.1.3",
        "@ionic-native/core": "3.10.2",
        "@ionic-native/sqlite": "^3.12.1",
        "@ionic/storage": "2.0.1",  
        "angular2-moment": "^1.1.0", 
        "cordova-android": "^6.2.3",
        "cordova-plugin-compat": "1.1.0",
        "cordova-plugin-console": "^1.0.7",
        "cordova-plugin-device": "^1.1.6",
        "cordova-plugin-file": "^4.3.3",
        "cordova-plugin-splashscreen": "^4.0.3", 
        "cordova-plugin-statusbar": "^2.2.3",
        "cordova-plugin-whitelist": "^1.3.2",
        "cordova-plugin-x-socialsharing": "^5.1.8",
        "cordova-sqlite-storage": "^2.0.4",  
        "ionic-angular": "3.5.2",
        "ionic-native": "2.9.0",
        "ionic-plugin-keyboard": "^2.2.1",
        "ionicons": "3.0.0",       
        "rxjs": "5.4.0",
        "sw-toolbox": "3.6.0",
        "zone.js": "0.8.12"
    },
    "devDependencies": {
        "@ionic/app-scripts": "2.0.2",
        "typescript": "2.3.4"
    },
    "cordovaPlugins": [
        "cordova-plugin-statusbar",
        "cordova-plugin-device",
        "cordova-plugin-whitelist",
        "cordova-plugin-console",
        "ionic-plugin-keyboard",
        "cordova-plugin-splashscreen"
    ],
    "cordovaPlatforms": [],
    "description": "project_name: An Ionic project",
    "cordova": {
        "plugins": {
            "cordova-plugin-console": {},
            "cordova-plugin-device": {},
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-statusbar": {},
            "cordova-plugin-whitelist": {},
            "ionic-plugin-keyboard": {},
            "cordova-sqlite-storage": {},
            "cordova-plugin-file": {},
            "cordova-plugin-x-socialsharing": {}, 
        },
        "platforms": [
            "android"
        ]
    }
}

我发现您的实现存在两个问题

  • 您正在使用非常旧的本机依赖项。必须将其更新为最新的
    “@ionic native/core”:“3.13.1”,
    package.json
    文件

  • 之后,您可以使用
    Ionic native
    插件轻松实现它,如下所示

  • 这是你的电话号码


    我发现您的实现存在两个问题

  • 您正在使用非常旧的本机依赖项。必须将其更新为最新的
    “@ionic native/core”:“3.13.1”,
    package.json
    文件

  • 之后,您可以使用
    Ionic native
    插件轻松实现它,如下所示

  • 这是你的电话号码


    有控制台错误吗?你能不能也显示你的
    构造函数
    代码?我更新了我的问题。你能显示
    package.json
    文件吗?我在问题中添加了我的package.json。有控制台错误吗?你能不能也显示你的
    构造函数
    代码?我更新了我的问题。你能显示
    package.json
    文件吗?我在我的问题中添加了我的package.json。我是故意做这个版本控制的,因为使用ionic3的完整版本控制在Sqlite的性能上有问题。但是插件的版本仍然是最新的,而不是旧版本。这是使用本机插件的推荐方式。如果你不喜欢它,那么你必须在将来面对这种命运和更多。没有人可以帮助你。我也在使用Sqlite和最新版本爱奥尼亚。但我看不出它有任何性能问题。如果你有这样的问题,那么你必须在他们的git存储库中为它打开一个票证。我是故意做这个版本控制的,因为使用ionic3的完整版本控制在Sqlite的性能上有问题。但是插件的版本仍然是最新的,而不是旧版本。这是使用本机插件的推荐方式。如果你不喜欢它,那么你必须在将来面对这种命运和更多。没有人可以帮助你。我也在使用Sqlite和最新版本但我看不出它有任何性能问题。如果你有这样的问题,那么你必须在他们的git存储库中为它打开一个票证。
    {
        "name": "ionic-hello-world",
        "version": "0.0.0",
        "author": "Ionic Framework",
        "homepage": "http://ionicframework.com/",
        "private": true,
        "scripts": {
            "clean": "ionic-app-scripts clean",
            "build": "ionic-app-scripts build",
            "lint": "ionic-app-scripts lint",
            "ionic:build": "ionic-app-scripts build",
            "ionic:serve": "ionic-app-scripts serve"
        },
        "dependencies": {
            "@angular/common": "4.1.3",
            "@angular/compiler": "4.1.3",
            "@angular/compiler-cli": "4.1.3",
            "@angular/core": "4.1.3",
            "@angular/forms": "4.1.3",
            "@angular/http": "4.1.3",
            "@angular/platform-browser": "4.1.3",
            "@angular/platform-browser-dynamic": "4.1.3",
            "@ionic-native/core": "3.10.2",
            "@ionic-native/sqlite": "^3.12.1",
            "@ionic/storage": "2.0.1",  
            "angular2-moment": "^1.1.0", 
            "cordova-android": "^6.2.3",
            "cordova-plugin-compat": "1.1.0",
            "cordova-plugin-console": "^1.0.7",
            "cordova-plugin-device": "^1.1.6",
            "cordova-plugin-file": "^4.3.3",
            "cordova-plugin-splashscreen": "^4.0.3", 
            "cordova-plugin-statusbar": "^2.2.3",
            "cordova-plugin-whitelist": "^1.3.2",
            "cordova-plugin-x-socialsharing": "^5.1.8",
            "cordova-sqlite-storage": "^2.0.4",  
            "ionic-angular": "3.5.2",
            "ionic-native": "2.9.0",
            "ionic-plugin-keyboard": "^2.2.1",
            "ionicons": "3.0.0",       
            "rxjs": "5.4.0",
            "sw-toolbox": "3.6.0",
            "zone.js": "0.8.12"
        },
        "devDependencies": {
            "@ionic/app-scripts": "2.0.2",
            "typescript": "2.3.4"
        },
        "cordovaPlugins": [
            "cordova-plugin-statusbar",
            "cordova-plugin-device",
            "cordova-plugin-whitelist",
            "cordova-plugin-console",
            "ionic-plugin-keyboard",
            "cordova-plugin-splashscreen"
        ],
        "cordovaPlatforms": [],
        "description": "project_name: An Ionic project",
        "cordova": {
            "plugins": {
                "cordova-plugin-console": {},
                "cordova-plugin-device": {},
                "cordova-plugin-splashscreen": {},
                "cordova-plugin-statusbar": {},
                "cordova-plugin-whitelist": {},
                "ionic-plugin-keyboard": {},
                "cordova-sqlite-storage": {},
                "cordova-plugin-file": {},
                "cordova-plugin-x-socialsharing": {}, 
            },
            "platforms": [
                "android"
            ]
        }
    }
    
    import { SocialSharing } from '@ionic-native/social-sharing';
    
    constructor(private socialSharing: SocialSharing) { }
    
    // Check if sharing via email is supported
    this.socialSharing.canShareViaEmail().then(() => {
      // Sharing via email is possible
    }).catch(() => {
      // Sharing via email is not possible
    });