Bug 23762 - Facebook iOS SDK 3.19.0 throws an exception in FBSettings.IsPlatformCompatibilityEnabled
Summary: Facebook iOS SDK 3.19.0 throws an exception in FBSettings.IsPlatformCompatibi...
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: master
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Alex Soto [MSFT]
Depends on:
Reported: 2014-10-11 15:47 UTC by Udi
Modified: 2015-01-13 13:40 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 Udi 2014-10-11 15:47:48 UTC
When trying to use Facebook compatibility:
FBSettings.IsPlatformCompatibilityEnabled = true; // to use Graph v1.0) 
an exception is thrown:

MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: +[FBSettings enablePlatformCompatibility]: unrecognized selector sent to class 0x106348c
  at at (wrapper managed-to-native) ApiDefinition.Messaging:void_objc_msgSend_bool (intptr,intptr,bool)
  at MonoTouch.FacebookConnect.FBSettings.set_IsPlatformCompatibilityEnabled (Boolean value) [0x00000] in <filename unknown>:0
  at testApp.Login.ViewDidLoad () [0x00008] in /Users/user/Projects/testApp/testApp/ViewControllers/Login.cs:39
  at at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:62
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0001c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:45
  at testApp.Application.Main (System.String[] args) [0x00008] in /Users/user/Projects/testApp/testApp/Main.cs:17
Comment 1 Ram Chandra 2014-10-13 09:58:21 UTC
I have checked this issue and I am able to reproduce this issue.

When I try to set "IsPlatformCompatibilityEnabled" property of "FBSettings" class I am getting following exception:

"Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: +[FBSettings enablePlatformCompatibility]: unrecognized selector sent to class 0x4a5fa4"

Screencast: http://www.screencast.com/t/JVraWFffi6O

Exception details: https://gist.github.com/saurabh360/3a82edce95689db68ebe
Build Output: https://gist.github.com/saurabh360/c4725ba594bb5382d9c4

Environment Info:

=== Xamarin Studio ===

Version 5.6 (build 273)
Installation UUID: 6ea47b0d-1852-4aaf-808d-373ff0a5002b
	Mono 3.10.0 ((detached/633e444)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000020

=== Xamarin.Android ===

Version: 4.18.0 (Business Edition)
Android SDK: /Users/jatin66/Desktop/Backup/android-sdk-macosx
	Supported Android versions:
		1.6   (API level 4)
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.0   (API level 11)
		3.1   (API level 12)
		3.2   (API level 13)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.3   (API level 18)
		4.4   (API level 19)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Apple Developer Tools ===

Xcode 6.0.1 (6528)
Build 6A317

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 6049af6
Build date: 2014-10-12 21:49:14-0400

=== Xamarin.Mac ===

Version: (Business Edition)

=== Build Information ===

Release ID: 506000273
Git revision: 4fdf44df17d841e324e22b99c0e4671360036dfd
Build date: 2014-10-07 18:16:52-04

=== Operating System ===

Mac OS X 10.9.5
Comment 2 Alex Soto [MSFT] 2014-10-13 19:29:20 UTC
Oh there seems to be a binding mistake, while the selector is definitely right enablePlatformCompatibility it is missing a semicolon on it.
Comment 3 Alex Soto [MSFT] 2014-10-13 19:57:31 UTC
I have submitted a fix to the component store, should be live in the next days as version

In the meantime you can workaround the issue by adding the following to your class:

		[System.Runtime.InteropServices.DllImport (MonoTouch.Constants.ObjectiveCLibrary, EntryPoint = "objc_msgSend")]
		public static extern void SetEnablePlatformCompatibility (IntPtr receiver, IntPtr selector, bool enable);

and then where you want to set it to true you do:

		var classPtr = MonoTouch.ObjCRuntime.Class.GetHandle (typeof (FBSettings));
		var enableSelector = MonoTouch.ObjCRuntime.Selector.GetHandle ("enablePlatformCompatibility:");
		SetEnablePlatformCompatibility (classPtr, enableSelector, true);

that should unblock you.

Hope this helps.

Comment 4 Alex Soto [MSFT] 2014-10-15 20:33:47 UTC
Update is live at https://components.xamarin.com/view/facebookios

Comment 5 Udi 2014-10-16 11:19:58 UTC
The update fixed the problem and Facebook v1.0 can be used.

This fix is very important for developers that still need to get user's complete friends list while it's possible - until 05/2015 for apps that were created before 04/2014.

Alex - 10x for the quick fix! :)
Comment 6 Mohit Kheterpal 2015-01-13 13:40:30 UTC
As per comment 5, this issue is fixed.

Hence closing this issue by marking it as Verified.