Unity3D admob project on iOS does not compile: a solution

While working on our first game I had to implement for the first time ads in an app. After some searches on the web I found Admob was one of the most easy and complete SDKs to use. You just need to import this custom package and that’s it. Except that…wait. It does not compile on iOS 😱

The error’s from clang and family are really scary but I am here to save your day! Here’s a step-by-step tutorial to follow in order to solve this issue.

First of all open the workspace.

Schermata 2016-07-11 alle 18.20.40

Try to compile if you are feeling lucky, but I suspect that if you are here there’s a reason. It shouldn’t work.

Step-by-step Tutorial

To fix the issues there are two steps to follow:

  1. In “build setting” of the whole project enable C and C++ modules.
    Schermata 2016-07-11 alle 18.23.25
    Schermata 2016-07-11 alle 18.23.55
  2. Download the Admob idk for iOS (https://firebase.google.com/docs/admob/ios/download). Then drag and drop the .framework file into your project’s framework folder
    1. Schermata 2016-07-11 alle 18.24.49
      Schermata 2016-07-11 alle 18.24.53
  3. Third extra step: compile and smile!
    Schermata 2016-07-11 alle 18.29.47

Conclusion: this is the easiest way I found to fix the issue. Probably there are better ways like using given cocoapods setup correctly, but when you are working sometimes deadlines are not negotiable, so this is my best solution.

Category

  • Blog