Social Plugin (native.showPopup) not loaded, crash on device

So, I’ve been trying to show the iOS native popup window to post on Facebook (http://docs.coronalabs.com/plugin/CoronaProvider_native_popup_social/showPopup.html)

I’m adding the plugins table to the build.settings as instructed here http://docs.coronalabs.com/plugin/CoronaProvider_native_popup_social/ , the app compiles succesfully but crash on device.

The Device Log for the crash show this message:

[lua]

Dyld Error Message:

Library not loaded: /System/Library/Frameworks/Social.framework/Social 

[/lua]

Any idea why is this happening?

I’ve also tried the code here https://github.com/coronalabs/plugins-sample-native-popup-social  but I’m getting the same error on device (Library not loaded in the logs and crash)

I’m going to be digging into this today, let me do some research and see if I can duplicate it.

I built an app with it today and didn’t get that error.  What version of iOS are you trying to run it on?

I’m not 100% sure (that device is at the office), but I think it’s running a 5.x .

Mmmh just Googled a little, maybe the social framework is only available in ios6+?

However, the built-in twitter & email sharing popups (with native.showpopup) used to be correctly working on ios5 before

Facebook for certain only works on iOS 6 and later.  Twitter was supported on iOS 5, but this new SDK may not go back to 5.x.  Let me ask the engineer to see if he knows for sure.

Rob

I understand the Facebook sharing not working on ios5, still, since we’re using the same call showpopup for also emails and SMS, does it mean with the new builds we’re going to be unable to show a mail or SMS popup (besides twitter)? That would be a huge problem.

There needs to be runtime checks to ensure that the app makes no attempt to access any of the classes from the framework when you run on a device (or simulator) with iOS prior to 6.0.

Also need to weak link the Social framework to the project.

 

I understand some features not working on ios5 (Facebook) but definitely it shouldn’t crash the device.

 

Please when you know something let me know because I’m trying to figure out what I should do in my app.

Thanks

The native.showPopup() takes a bunch of different options:

  • mail
  • sms
  • appStore
  • rateApp
  • twitter
  • social

This plugin adds the “social” option.  The others are still there and function just like they always have.  That said, I’m not 100% sure about “twitter”.  It may be moving into social with the plans to deprecate twitter along the way.  But for now twitter still works as a stand alone call (just tested it) and it would still be needed for iOS 5.x.

Ah thanks Rob. I thought I needed to include the plugin for any native.showPopup request.

So basically the only thing that need fixing is the plugin crashing on pre ios6, otherwise any apps using the new social plugin will cause a crash on ios5 devices (instead of simply returning “false” and not being available) .

From what I’ve read on the web, it looks like it’s caused by the Social framework linked as required instead of optional (weak link?).

Ideally, we should also be able to see if a certain social function is available with the native.canShowPopup.

Hey PXL.

The social plugin is indeed iOS6 only. We are using apples SLComposeViewController class, so that is why the twitter part of the plugin isn’t backwards compatible with iOS 5.

You can already see if a certain social function is available via native.canShowPopup() you call:

native.canShowPopup( “social”, providerName ) – where providerName is either twitter, facebook or sinaWeibo (this is documented on the plugin’s page.

I agree it definitely shouldn’t be crashing on iOS5, we will get that rectified asap.

EDIT : The crash issue has been fixed and the fix will be available shortly. (I will notify you when the updated/fixed plugin is up)

(interesting tidbit, less than 5% of iOS users are on iOS5, and also every device on iOS5 can be upgraded to iOS6 afaik)

Thanks!

Thanks a lot Danny! 
Yeah the percentage of users using iOS5 is already low and getting smaller every day, but I have some apps still with around 8% iOS5 users (I think old ipod devices).  

So, just to be sure, the Twitter/Email/Sms popup will continue working on iOS5 or with the new SLComposeViewController we’re going to lose Twitter on iOS5?

Hey PXL.

The Twitter/Email/Sms popup that exists today will continue working with iOS 5 yeah. That hasn’t been replaced.

I pushed up a fix for the iOS 5 crash with the social plugin yesterday, can you confirm it now doesn’t crash for you? 

Thank you

Hi Danny, yes I can confirm you the social plugin does not crash on iOS5 anymore.

BTW, I ran some tests for the behaviours of canShowPopup and showPopup on iOS5/iOS6:

1. native.canShowPopup (“social”,serviceName)

(social plugin type call) where serviceName is: facebook, twitter

always returns nil on iOS5, works correctly on iOS6 

(maybe it would be better if it returned false instead of nil)

2. native.canShowPopup (serviceName) 

(old type call, without “social”) where serviceName is twitter

returns true/false correctly on iOS5 and iOS6

3. native.showPopup(“twitter”, options) 

(old type call) works correctly on iOS5/iOS6 devices

4. native.showPopup(“social”, options)

(new type call) where options is twitter/facebook

does not work on iOS5, works on iOS6

So basically, as a general rule :

  • if the native.canShowPopup(“social”,…) returns true we are in iOS6+ and we can use the new native.showPopup(“social”,…)

  • if the native.canShowPopup(“social”,…) returns nil BUT native.canShowPopup(“twitter”) returns true we are on iOS5 and can still use native.showPopup(“twitter”,…) to show the Twitter popup

Hey PXL.

I decided returning nil was a better option, because the canShowPopup function can return false in a situation where the service is available but there are no accounts set up for that service on the device.

If it returns nil, then you have a clear indication that the service isn’t available at all on the iOS version in question. Does that make sense?

Danny you’re right, it makes sense to return nil in that case.

Thanks again for your work!

I’m going to be digging into this today, let me do some research and see if I can duplicate it.

I built an app with it today and didn’t get that error.  What version of iOS are you trying to run it on?

I’m not 100% sure (that device is at the office), but I think it’s running a 5.x .

Mmmh just Googled a little, maybe the social framework is only available in ios6+?

However, the built-in twitter & email sharing popups (with native.showpopup) used to be correctly working on ios5 before

Facebook for certain only works on iOS 6 and later.  Twitter was supported on iOS 5, but this new SDK may not go back to 5.x.  Let me ask the engineer to see if he knows for sure.

Rob