Bug 31019 - [Facebook iOS SDK] Different behaviors between debug and release modes
Summary: [Facebook iOS SDK] Different behaviors between debug and release modes
Status: RESOLVED ANSWERED
Alias: None
Product: Components
Classification: Xamarin
Component: Xamarin Components ()
Version: Production (addons.xamarin.com)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Israel Soto [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2015-06-11 09:38 UTC by Daniel
Modified: 2015-06-25 20:48 UTC (History)
1 user (show)

Tags:
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:
Status:
RESOLVED ANSWERED

Description Daniel 2015-06-11 09:38:43 UTC
Hi,

On Facebook iOS ( version 4.1) I am using the class ShareDialog with the ISharingDelegate to get return for the Didcomplete, Didfail or Didcancel actions (see code below).

When I share on Debug mode it works great posting on Facebook and returning the msg of DidComplete method, but when I run it on Release mode, the msg is shared (correct) but returns to the DidCancel method doing a WRONG alert msg.

    #region ISharingDelegate Implement

    public void DidComplete (ISharing sharer, NSDictionary results)
    {
        NavigationController.PushViewController(videoViewController, true);
        new UIAlertView ("MyApp!", "MyMessage!", null, "Ok", null).Show ();
    }

    public void DidFail (ISharing sharer, NSError error)
    {
        new UIAlertView ("Error...", error.Description, null, "Ok", null).Show ();
        NavigationController.PushViewController(videoViewController, true);
    }

    public void DidCancel (ISharing sharer)
    {
        new UIAlertView ("Cancelled", "The share post was cancelled", null, "Ok", null).Show ();
    }

    #endregion
Thanks,
Daniel
Comment 1 Israel Soto [MSFT] 2015-06-11 12:48:15 UTC
Hi Daniel,

Can you provide me the following info:

1. Your current version of Xamarin Studio and Xamarin.iOS
2. A sample where I can reproduce the behaviour, you can add it here, or a link to Dropbox or something like that.

Thanks in advance.
Comment 4 Israel Soto [MSFT] 2015-06-12 12:57:41 UTC
Hi Daniel,

I tested your app and yes, the bug is there. I reviewed the Facebook iOS issues on Github and someone posted the issue already:

https://github.com/facebook/facebook-ios-sdk/issues/773

Waiting for Facebook for a response.

Greetings!
Israel Soto
Comment 5 Daniel 2015-06-15 11:04:41 UTC
Hi Israel,

Thank you for your answer.

Is it possible to make some workaround?

Can I try older versions of this component to see if this bug happened? I mean, is there a way to install the version 4.0.1.3 to test?

Thanks,
Daniel
Comment 6 Israel Soto [MSFT] 2015-06-17 14:29:14 UTC
Yes Daniel,

you can download a previous version of every component from the page. I share you the link of a previous version of FB:

http://components.xamarin.com/view/facebookios?version=4.0.1.3

Remember that we don't ship the dll's with the zip file anymore, so, download the component and get the dll from the sample.

Greetings!
Israel Soto
Comment 7 Israel Soto [MSFT] 2015-06-24 13:06:35 UTC
Hi Daniel,

Someone gave the solution with the problem, and it seems that is not a bug:
https://github.com/facebook/facebook-ios-sdk/issues/773#issuecomment-114813769

I hadn't noticed that you were missing a method in the AppDelegate file.

You need to override the OpenUrl method and let Facebook to handle the OpenUrl method with their own method:

public override bool OpenUrl (UIApplication application, NSUrl url, string sourceApplication, NSObject annotation)
{
	return ApplicationDelegate.SharedInstance.OpenUrl (application, url, sourceApplication, annotation);
}

I tested the app with this and everything is working right.

Happy coding!
Israel Soto.
Comment 9 Israel Soto [MSFT] 2015-06-25 12:52:54 UTC
Hi Daniel!

I ignored the following code:
-----------------------------------------------------------------------------------
NSString *FACEBOOK_SCHEME = @"fb_<YOUR_FACEBOOK_APP_ID>";
    if ([[url scheme] isEqualToString:FACEBOOK_SCHEME])
-----------------------------------------------------------------------------------

because of this comment:
https://github.com/facebook/facebook-ios-sdk/issues/773#issuecomment-114954877

He said that wasn't necessary to check the Scheme.

The [FBSDKAppEvents activateApp]; message is just for Facebook Analytics, so is not necessary either.

On another topic, I think I found the reason of why the DidComplete method is calling. FB is not handling in a proper way their Share Dialogs. Someone else report an issue about this and I shared a sample that reproduces the bug:

https://github.com/facebook/facebook-ios-sdk/issues/781#issuecomment-115306738

If you want to reproduce the error with a C# sample, here is the link:
https://www.dropbox.com/s/rec0xmupu7zofxj/FacebookTestXamarin.zip?dl=0
Comment 10 Israel Soto [MSFT] 2015-06-25 20:48:44 UTC
Hi Daniel,

FB gave us a response and that we thought that was a bug, is actually their normal flow. They explain this in their docs:

https://developers.facebook.com/docs/ios/troubleshooting#onsuccess

Greetings!
Israel Soto