Catlard Catlard - 3 months ago 12
C# Question

Unity GameAnalytics plugin failing on iOS build

I'm building an iOS app in unity 5.4.0f3 (the latest), with GameAnalytics plugin 3.5.2 (the latest), downloaded from https://github.com/GameAnalytics/GA-SDK-UNITY. Even with an empty project -- nothing but the plugin -- I get an error when attempting to build. The error is:

Assets/GameAnalytics/Plugins/Scripts/Wrapper/GA_Wrapper.cs(312,25): error CS0103: The name `setManualSessionHandling' does not exist in the current context

This does not happen for android or standalone desktop builds.

Does anyone know of a workaround?

enter image description here

Answer

This is a bug in the GameAnalytics code. I suggest you contact the publisher and file for bug report to get it fixed. The current workaround is to simply comment out line 312 in the GA_Wrapper script which is located at Assets\GameAnalytics\Plugins\Scripts\Wrapper.

Here is the exact code to comment out.

public static void SetEnabledManualSessionHandling(bool enabled)
{
    //setManualSessionHandling(enabled); //Comment out this code.
}

Your code should now compile. I wouldn't mess with anything else to make sure that the plugin works as expected. It is safe to comment out that line of code because what the setManualSessionHandling; function is only used to display Debug.Log.

setManualSessionHandling function is actually present in the script but a bad Preprocessor Directives code made it unavailable during compile time for iOS. This is a temporary fix. Again, file for a bug report to let them there is a problem with their plugin when building for iOS.