【问题标题】:Ionic cordova social sharing plugin always returning true离子科尔多瓦社交分享插件总是返回真实
【发布时间】:2017-11-15 21:49:45
【问题描述】:

Cordova 社交分享插件 (Facebook) 在 .then(function(res)) 中始终返回 true。在发布之前显示为真。如果我们取消分享发布,那么它也返回真。 .then(function()) 在发布之前返回 true。请任何人帮忙。非常紧急。需要代码帮助。

$scope.share_fb = function(message, logo, url){
$cordovaSocialSharing.shareViaFacebook(message, '', url)
    .then(function (result) {
    var link=site_url+"share_point?id="+user_id;
                                        $http.post(link).success(function(res){
                                        $scope.load_profile();
                                        });
                                    $ionicLoading.hide().then(function(){});
    }, function(error) {
                         alert("Cannot share on Facebook");
                     })
}
$cordovaSocialSharing.canShareVia("facebook", message, logo, url).then(function(result) {
        $scope.share_fb(message, logo, url);


                }, function(error) {
                    alert("Cannot share on Facebook");
                });

【问题讨论】:

  • 请在此处添加一些代码
  • 大家好,请大家帮忙。

标签: cordova ionic-framework


【解决方案1】:

如此处所示:similar question + answer on the Ionic forums

var isIOS = ionic.Platform.isIOS();
var isAndroid = ionic.Platform.isAndroid(); 


if(isIOS) {
    $cordovaSocialSharing.canShareVia("instagram").then(function(result) {  
        $scope.canShareInstagram  = true; 
    }, function() {
        $scope.canShareInstagram  = false;
    });               
} else {
   if(isAndroid) {
    $cordovaAppAvailability.check('com.instagram.android')
        .then(function() {
            $scope.canShareInstagram  = true;
        }, function () {
            $scope.canShareInstagram  = false;
        });            
   } 
}

这是一个同样令人满意的解决方法。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-08-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-13
    • 2017-11-04
    相关资源
    最近更新 更多