Bug 12105 - SLComposeViewController.IsAvailable not work correctly
Summary: SLComposeViewController.IsAvailable not work correctly
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 6.2.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-05-06 01:45 UTC by Simon Hu
Modified: 2013-05-13 05:18 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Simon Hu 2013-05-06 01:45:12 UTC
weiboButton.TouchUpInside += delegate {
    if (SLComposeViewController.IsAvailable (SLServiceKind.SinaWeibo)) {                
        slComposer = SLComposeViewController.FromService (SLServiceType.SinaWeibo);
        slComposer.SetInitialText ("test");
        slComposer.AddImage (UIImage.FromFile ("demopic.jpg"));

        slComposer.CompletionHandler += (result) => {
            InvokeOnMainThread (() => {
                DismissViewController (true, null);
                resultsTextView.Text = result.ToString ();

        PresentViewController (slComposer, true, null);
Comment 1 Simon Hu 2013-05-06 01:45:36 UTC
The above code works on Simulator but not device.
Comment 2 Simon Hu 2013-05-06 03:56:16 UTC
using debug to step into it, print the value on the immediate window.

>SLComposeViewController.IsAvailable (SLServiceKind.SinaWeibo) 

On the device, it always return false, on the simulator, it returns true.

both happened on Xamarin.iOS alpha and latest stable version.
Comment 3 Rolf Bjarne Kvinge [MSFT] 2013-05-08 06:00:51 UTC
You must be signed in to a Sina Weibo account in the settings on the device for it to return true - are you signed in?
Comment 4 Simon Hu 2013-05-08 08:42:05 UTC
Hi, Rolf.

The problem is not signed in or not. on the simulator, if you don't sign in before, it will pop up a dialog to ask you sign in before use.

also, if I removed "if (SLComposeViewController.IsAvailable (SLServiceKind.SinaWeibo)) ", it works well. 

The only problem is that SLComposeViewController.IsAvailable not work on device.

You can use the social framework sample listed in Xamarin Docs, you will find the problem.


Comment 5 Rolf Bjarne Kvinge [MSFT] 2013-05-09 09:33:08 UTC
Apple's documentation is quite clear about IsAvailable:

"Returns a Boolean value indicating whether the service is accessible and at least one account is set up."


The fact that it works differently in the simulator is probably a convenience feature, but not how it's really supposed to work on device.
Comment 6 Simon Hu 2013-05-12 11:18:45 UTC
Hi, Rolf.

Thanks for the link. and yes, while I login first in settings social page. everything works fine.

but on previous version of iOS6, the device acts absolutely like what it does on simulator. So it means apple change something.

Comment 7 Rolf Bjarne Kvinge [MSFT] 2013-05-13 05:18:32 UTC
Yes, unfortunately Apple changes things all the time.