EddyVerbruggen / SocialSharing-PhoneGap-Plugin

👨‍❤️‍💋‍👨 Cordova plugin to share text, a file (image/PDF/..), or a URL (or all three) via the native sharing widget
MIT License
1.78k stars 909 forks source link

Crash when trying to share on iOS #487

Open CGeorges opened 8 years ago

CGeorges commented 8 years ago

I'm using Ionic and compiling in XCode, seems the plugin crashes the application on any device version with the following code:

$cordovaSocialSharing.share($filter('strip_html')($scope.article.excerpt), $scope.article.title, $scope.article.thumbnail, article_url);

I changed all values to null and still crashes, the error in XCode says [11631:3520530] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM hasPrefix:]: unrecognized selector sent to instance 0x7f9623871f20'

I managed to pinpoint the offending code within the plugin but the thumbnail no longer works if I comment it out http://screencast.com/t/wpoxq1orfc0Q. My knowledge of Objective-C is very limited.

EddyVerbruggen commented 8 years ago

Hi, what's the value of $scope.article.thumbnail? So what do you see when doing console.log($scope.article.thumbnail) and console.log(typeof $scope.article.thumbnail)?

CGeorges commented 8 years ago

https://css.domain.com/wp-content/uploads/ngg_featured/2010-09-05-16-20-23-160x100.jpg string

I edited the domain

CGeorges commented 8 years ago

Maybe this help too http://screencast.com/t/BWlgDdnz0

EddyVerbruggen commented 8 years ago

Does it work when using any other random picture from the internet? Perhaps one of the examples in the readme? Otherwise, can you pass it in as a JS array and see what happens?

CGeorges commented 8 years ago

I've passed it as null and still crashes the app.

CGeorges commented 8 years ago

Passing it as array or a random picture has the same effect.

EddyVerbruggen commented 8 years ago

Can you share your project with me perhaps? eddyverbruggen at gmail

elloboblanco commented 8 years ago

I'm seeing the same thing as @CGeorges, invoking this plugin via the ngCordova wrapper.

var message = 'Check out ' + $scope.artist.Name + ' playing at Treefort Music Fest!';
var subject = message;
var link = 'http://open.treefortlines.com.s3-website-us-west-2.amazonaws.com/artist/' + $scope.artist.Id;

$cordovaSocialSharing
  .share(message, subject, null, link) // Share via native share sheet
  .then(function(result)
  {
    $log.info('success sharing ' + $scope.artist.Name + ' : ' + result);
  }, function(err)
  {
    $log.info('error sharing ' + $scope.artist.Name + ' : ' + err);
  });
pinkli commented 8 years ago

exactly same issue here, on Yosemite, XCode 6.4, cordova 6.1.1, deployed to iOS 7.1. But when I update the iOS to the latest 9.3, it works.

vance commented 8 years ago

upgraded to iOS 10, crash happens again.

srameshr commented 8 years ago

@EddyVerbruggen Same here. Upgraded to iOS 10; crashes. Same share works well on Android.

jkassis commented 7 years ago

Works sometimes but lots of crashing. Seems worse in lesser spec devices

keithdmoore commented 7 years ago

If someone else stumbles across this, try sending an array even if you just have a single file.