-
Notifications
You must be signed in to change notification settings - Fork 262
Open
Labels
Description
Causes a fatal crash on Android (multiple devices and OS)
- Unity Version: 6000.0.46f1
- Facebook SDK:
- Unity IAP Version: 5.0.1
Manifest:
<meta-data android:name="com.facebook.sdk.AutoLogAppEventsEnabled" android:value="false" />
I also disabled all automatic events in Facebook Developer and Facebook Event Manager
In code I also set SetAutoLogAppEventsEnabled to false:
FB.Mobile.SetAutoLogAppEventsEnabled(false);
Debugging IsImplicitPurchaseLoggingEnabled() returns false
var isImplicitPurchaseLoggingEnabled = FB.Mobile.IsImplicitPurchaseLoggingEnabled();
TargetException: Non-static method requires a target.
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <00000000000000000000000000000000>:0
at Facebook.Unity.CodelessIAPAutoLog.addListenerToGameObject (UnityEngine.Object gameObject, System.Object listenerObject) [0x00000] in <00000000000000000000000000000000>:0
at Facebook.Unity.CodelessIAPAutoLog.addListenerToIAPButtons (System.Object listenerObject) [0x00000] in <00000000000000000000000000000000>:0
Using Rider to Decompile CodelessIAPAutoLog, it doesnt seem like addListenerToIAPButtons handles IsImplicitPurchaseLoggingEnabled:
internal static void addListenerToIAPButtons(object listenerObject)
{
UnityEngine.Object[] objectsOfTypeByName = CodelessIAPAutoLog.FindObjectsOfTypeByName("IAPButton", "UnityEngine.Purchasing");
if (objectsOfTypeByName == null)
return;
foreach (UnityEngine.Object gameObject in objectsOfTypeByName)
CodelessIAPAutoLog.addListenerToGameObject(gameObject, listenerObject);
}
For example, maybe this would solve it:
internal static void addListenerToIAPButtons(object listenerObject)
{
//Suggestion
if (!FB.Mobile.IsImplicitPurchaseLoggingEnabled())
return;
UnityEngine.Object[] objectsOfTypeByName = CodelessIAPAutoLog.FindObjectsOfTypeByName("IAPButton", "UnityEngine.Purchasing");
if (objectsOfTypeByName == null)
return;
foreach (UnityEngine.Object gameObject in objectsOfTypeByName)
CodelessIAPAutoLog.addListenerToGameObject(gameObject, listenerObject);
}
Expected behaviour:
When FB.Mobile.IsImplicitPurchaseLoggingEnabled() returns false, addListenerToIAPButtons should not execute
Reactions are currently unavailable