I am having this crash occuring on IPod devices only when I add the google’s analytics lib to the xcode project ( without changing ) any code. If I remove the lib reference from the project, the game works fine on ipods. When I add the lib back in, it crashes again. However, nothing crashes on iPhones.
You can get the sdk from Google Analytics | Google for Developers and add libGoogleAnalytics.a.
- (void) startUnity:(UIApplication*)application
{
//…
printf_console(“-> SECTION FIRST\n”);
UnityInitApplication(appPath);
printf_console(“-> SECTION FIRST 2\n”);
}
Yields:
→ applicationDidFinishLaunching()
→ SECTION FIRST
Program received signal: “EXC_BAD_ACCESS”.
I tested (with lib added )
iPod - 3.1.3 - crashes
iPod - 4.1 - crashes
iPod - 4.2 - crashes
iPhone - All - No Crash
without lib added
all - all - no crash
So my question is, is there something special I have to do if I want to inject a few lines of code into the appDidFinish delegate from with in unity?
I am using Unity 3.3, with xcode version 3.2.5
Hello Rhapsodus, I’ve been trying to add Google Analytics Mobile on an iPad app also and I can’t make it compile right now.
My steps:
Added libGoogleAnalytics.a to the project.
Added libsqlite3.0 Framework
Created a new class : GAManager.mm with a method:
#ifdef __cplusplus
extern “C” void StartGATracker(){
NSLog(@“StartGATracker”);
}
#endif
At my unity project I added an C# class with the code:
void Start () {
StartGATracker();
}
[DllImport (“__Internal”)]
public static extern float StartGATracker();
And I get the following error while the build process is trying to link:
ld: ldr 12-bit displacement out of range (4316 max +/-4096) in _AudioComponentFindNext$stub in _AudioComponentFindNext$stub from *****
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g+±4.2 failed with exit code 1
where ***** is my project files path
I’m using Unity 3.3 and XCode 3.2.5
Any clue?
Thanks in advance
the error you get during build means that you likely exceeded the max app size.
you need to remove something. For example use .NET subset only or ensure that you disabled the runtime debugger, profiler (and after both are disabled, the dev mode) in the build settings so your binary size no longer is too large.
Hello dreamora I really don’t think thats the case. The game I’m trying to put some analytics is a 51mb game…
I will try to add analytics to a new Unity project and see what happens.
Thanks anyway
Ok, just tested with a very small project and it worked…
dreamora I tried to find any info about project size but could not find, do you have any documentation about it?
Thanks
There is none, the ld error is fired from xcodes linker and apple does not offer anything.
I know though from experience that at least on the 4.2 SDK, the “deadline” is at about 40mb of pure application data (the extension less binary inside the ipa). to reach that though you normally need to have the Debugger enabled (unsure if the bug I reported was fixed on the unity version you use but there was a bug that even disabling the development build did not disable the debugger and the debugger in 3.3 raises the binary size by 100-200% so a 17mb one can easily hit the 35-40mb)
Hmm I found it very strange that XCode has a size limit… I’ve seen more than once an app with 600mb or more…
My game is big because we use high rez textures and we have a couple of videos. Those things I don’t want to take out for the sake of analytics. 
And my game is bigger than 40mb already…
Well. I will keep searching for a solution, if anything pops up I will post here.