1
votes

am using unity 5.4.0p2 and am tring to use facebook sdk for unity version 7.8.0 but am getting this error when I imported the package :

Assets/FacebookSDK/SDK/Scripts/Results/AppLinkResult.cs(51,43): error CS0121:

The call is ambiguous between the following methods or properties: Facebook.Unity.Utilities.TryGetValue<System.Collections.Generic.IDictionary<string,object>>(this System.Collections.Generic.IDictionary<string,object>, string, out System.Collections.Generic.IDictionary<string,object>)

and

Facebook.Unity.Utilities.TryGetValue<System.Collections.Generic.IDictionary<string,object>>(this System.Collections.Generic.IDictionary<string,object>, string, out System.Collections.Generic.IDictionary<string,object>)

I have done a lot of search but nothing helped me , so can someone explain what am doing wrong ?

4

4 Answers

0
votes

I fixed it, I deleted Facebook SDK and reimported it again and now it's working

0
votes

there may possibly be two methods of same definitions in two different namespaces. Search all the project for TryGetValue if there are two definitions of same method at different places, try to call the method by using namespace.

For example int n = Random.Range(1,10); would give error as Random class is ambiguous between System and UnityEngine. To resolve this you would either use

int n = UnityEngine.Random.Range(1,10);

or

int n = System.Random.Range(1,10);

Edit: In your case having duplicate files in Facebook SDK would give same error.

0
votes

The same problem happened to me when I tried to update the Facebook SDK in my Unity project.

CORRECT ANSWER... I realized the correct way to update the FB SDK, is to open your Unity project, delete the FacebookSDK folder. Install the FB SDK. The End.

WRONG ANSWER... The wrong approach is to delete the FacebookSDK folder then restart Unity, then install the new FB SDK. That creates problems like OP mentioned. Another wrong approach is not deleting the FacebookSDK folder, and then just installing the new FB SDK. That also creates problems like OP mentioned.

0
votes

Check for duplicate SDKs. For example if you have Voodoo packages installed then it will conflict with Facebook SDK. Because Voodoo packages already includes the same classes.