Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXC_BAD_ACCESS on iOS #1

Closed
vad710 opened this issue Aug 25, 2014 · 9 comments
Closed

EXC_BAD_ACCESS on iOS #1

vad710 opened this issue Aug 25, 2014 · 9 comments

Comments

@vad710
Copy link

vad710 commented Aug 25, 2014

I am getting a crash EXC_BAD_ACCESS when running on my iOS device via xcode. It looks like it is being raised on the "setSampleFrequency" call. I have my SampleFrequency set to 100 - this crash does not appear to happen on Android.

@emmanuellemm
Copy link
Contributor

Thank you for reporting the issue. I really appreciate you taking the time to do so, it helps us make the plugin better!

I tried running a sample app on iOS and was able to build and run without crashing. However, I was able to reproduce it if I didn't follow the iOS specific build steps you can see here. Did you add the mod_pbjproj.py and PostprocessBuildPlayer_GA.txt files to your Assets/Editor directory? These will add the linked libraries required to run the project in Xcode with the plugin.

Please try it out if you haven't already done so and let me know either way if it helps. Thanks again, your feedback is really important!

@vad710
Copy link
Author

vad710 commented Aug 25, 2014

I have followed the steps carefuly - if I did not follow the steps the app would not build at all.

Some additional info - it appears like this only happens on the second "LogScreen()" call - the first "LogScreen()" is successful. I have tried both using the EventHitBuilder as well as the string parameter.

@vad710
Copy link
Author

vad710 commented Aug 25, 2014

Oh - one more thing. I do not have the ".txt" extension in the "PostprocessBuildPlayer_GA" file. I will try putting the ".txt" extension and see if it works.

I have also gone through the process of adding the libraries manually in xcode and see the same behavior :(

@vad710
Copy link
Author

vad710 commented Aug 25, 2014

The extension on the file did not make a difference. I confirmed that my Prefabs are setup correctly and also tested on the Android version. The Android version seems to be working correctly, so I believe it is something specific to iOS.

I also set the logging to be verbose on the Prefabs, but that did not seem to make a big difference.

@emmanuellemm
Copy link
Contributor

Thank you for the additional information and I appreciate you taking the time to follow up. If one of your LogScreen() calls is being sent successfully then it would not be a build error so I wouldn't expect the file extension to change anything, I misunderstood and thought you were having problems building.

'setSampleFrequency' is only called during initialization, which should only occur when the first hit is sent from the app, unless you call Dispose() which will reset the tracker. If you are calling Dispose(), it should reset the tracker and the next hit will call the initialization method with the existing parameters, so I wouldn't expect an exception if it was fine the first time.

I'm trying to think of different possibilities that could cause this issue as I am not able to reproduce it in my environment. Please don't be offended if they are basic questions - just want to rule out all options to get this resolved as fast as possible for you :).

  1. How do you know the first call to LogScreen is successful? Are you able to see it in the realtime reports?
  2. Are you creating a new private variable for the GoogleAnalyticsV3 object in each file you wish to send tracking hits from?
  3. Is there anything special occurring between sending the two LogScreen() hits? (memory management or garbage collection)
  4. Are the hits in two different scenes (and do the scenes each have the prefab in their object hierarchy)?
  5. Did you drag the prefab onto the inspector variable in the script for each script you added tracking to?

Thanks!

@vad710
Copy link
Author

vad710 commented Aug 26, 2014

Hi @emmanuellemm ,

I appreciate you following up!

I will try to answer your questions below.

  1. I did see the screen logging in the RealTime Reports - and now i also see the iOS device I was testing with under "Audience/Devices"
  2. In each Screen which I want to track, I have a public variable for the GoogleAnalyticsV3 object in a Unity script attached to a game object. The reason why it's public is so that I can then drag the PreFab onto the Script.
  3. There should not be anything special happening between the two screens - the only thing that comes to mind is that I display a NativeX advertisement in between the screens.
  4. The first call to "LogScreen" is in one scene and the second call to "LogScreen" is in another scene (the one that crashes). Each scene has a copy of the GAv3 prefab on the root of the Scene hierarchy. I will try to elaborate on each of the scenes:

In addition to the GAv3 prefab on the root of the scene hierarchy, I also have an empty game object called "Analytics" which has the following simple code attached:

    public class GoogleAnalytics : MonoBehaviour 
    {
        public GoogleAnalyticsV3 GoogleAnalyticsPrefab;

        public void Start()
        {
            this.GoogleAnalyticsPrefab.StartSession();
            this.GoogleAnalyticsPrefab.LogScreen("MainMenu");
        }
    }

I then have the GAv3 object from the scene hierarchy linked to the public GoogleAnalyticsPrefab object.

I have something very similar in the Second scene. The difference is that I am reusing a script that is attached to the Camera object.

    public void Start () 
    {
        // other code removed for brevity 

        this.GoogleAnalyticsPrefab.LogScreen("Match");
    }

and it looks like it's crashing on the LogScreen call.

  1. Yes - I dragged the Prefab onto the inspector variable of the scripts that are using the Analytics code as I tried to mention on number 4.

Also - I am not doing anything extra with the Dispose method.

I understand that these issues are sometimes hard to reproduce. Please let me know how else I can help you reproduce this issue.

thanks again!

@emmanuellemm
Copy link
Contributor

Really appreciate all the information, thanks for your help in getting this sorted :) Using your snippets and a multiple scene project I was able to reproduce the issue so I will investigate a fix.

@emmanuellemm
Copy link
Contributor

I have submitted a fix, if you could please try it out when you have time that would be helpful. Please reopen the issue if it does not solve the problem for you.

@vad710
Copy link
Author

vad710 commented Aug 27, 2014

Hi @emmanuellemm ,

I am happy to hear that you were able to get to the bottom of this issue. I had to work around the issue by only calling LogScreen once in the game. When I get a chance, I will test it out again and let you know.

thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants