Linking errors when adding AdMob to IOS cocos2d-x 3.2

i trying to add AdMob to cocos2d-x 3.2 simple game
using Xcode 5.1 iOS 7.1
i following the tutorials in
https://developers.google.com/mobile-ads-sdk/docs/#ios
and
http://plaincode.blogspot.co.il/2014/02/example-of-admob-integration-in-cocos2d.html

and after adding the -ObjC flag in the “Other Linker Flags”

I’m getting linking errors:

Undefined symbols for architecture armv7s:
  "_GCControllerDidDisconnectNotification", referenced from:
      -[GCControllerConnectionEventHandler observerConnection:disconnection:] in libcocos2dx iOS.a(CCController-iOS.o)
  "_GCControllerDidConnectNotification", referenced from:
      -[GCControllerConnectionEventHandler observerConnection:disconnection:] in libcocos2dx iOS.a(CCController-iOS.o)
  "_OBJC_CLASS_$_MPMoviePlayerController", referenced from:
      objc-class-ref in libcocos2dx iOS.a(UIVideoPlayerIOS.o)
  "_OBJC_CLASS_$_GCController", referenced from:
      objc-class-ref in libcocos2dx iOS.a(CCController-iOS.o)
     (maybe you meant: _OBJC_CLASS_$_GCControllerConnectionEventHandler)
  "_MPMoviePlayerPlaybackStateDidChangeNotification", referenced from:
      -[UIVideoViewWrapperIos dealloc] in libcocos2dx iOS.a(UIVideoPlayerIOS.o)
      -[UIVideoViewWrapperIos setURL::] in libcocos2dx iOS.a(UIVideoPlayerIOS.o)
  "_MPMoviePlayerPlaybackDidFinishNotification", referenced from:
      -[UIVideoViewWrapperIos dealloc] in libcocos2dx iOS.a(UIVideoPlayerIOS.o)
      -[UIVideoViewWrapperIos setURL::] in libcocos2dx iOS.a(UIVideoPlayerIOS.o)
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)

when i removing the -ObjC flag
then I’m getting :

<Google> Category methods are not loaded. Make sure you link the Google Mobile Ads library using one of the -ObjC, -force_load, or -all_load linker flags. See https://developers.google.com/mobile-ads-sdk/docs/#ios for more information.

what is wrong here ?

This is a typical problem with many ObjC projects. Not all libraries/frameworks play nicely with the -ObjC flag, and when you add it as a linker flag, it applies to all.

Instead of doing that, try to -force_load the AdMob library separately. How? Here is an example of how I link GoogleAnalytics:

2 Likes

Link the frameworks as in the picture:

And apply the patch, look here: Duplicate symbol after migrating to 3.2RC0

1 Like

Thanks to Mazyod…

I also restrict this problem on c2dx 3.2…
I solved it like Mazyod’s solution…

I removed -ObjC flag from Other Link Flags. And added bellow.
-force_load “$(SRCROOT)/iOS/ExtPlatforms/adlibr/ads_platform/admob/libGoogleAdMobAds.a”
to Other Link Flags.

And…works well.

Thanks. It worked for me.

can you help me about admob ios integration

thanks for help.

what help did you need isa_can?