将AdMob添加到IOS cocos2d-x 3.2时链接错误

use*_*898 6 objective-c admob cocos2d-x cocos2d-x-3.0

我尝试
使用Xcode 5.1 iOS 7.1
i将adMob添加到cocos2d-x 3.2简单游戏中,遵循https://developers.google.com/mobile-ads-sdk/docs/#ios
http://plaincode.blogspot中的教程 .co.il/2014/02 /实例-的-AdMob的集成功能于cocos2d.html

并在"Other Linker Flags"中添加-ObjC标志后

我收到链接错误:

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)
Run Code Online (Sandbox Code Playgroud)

当我删除-ObjC标志然后我得到:

<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.
Run Code Online (Sandbox Code Playgroud)

这有什么不对?

Jas*_*sio 29

-ObjC加载实现Objective-C类或类别的静态归档库的所有成员.(https://developer.apple.com/library/mac/qa/qa1490/_index.html)

在cocos2d-x 3.2中在此输入图像描述

CCController-iOS.mm - > #import <GameController/GameController.h>
UIVideoPlayerIOS.mm - >#import <MediaPlayer/MediaPlayer.h>

所以你得到了那些错误.

解决方案: 只需添加以下框架BuildSettings - > Build Phase - > Link Binary with libraries

MediaPlayer.framework
GameController.framework
Run Code Online (Sandbox Code Playgroud)


Nar*_*rek 1

是的,原因是为 AdMob 支持添加了 -ObjC 标志。我已将 MediaPlayer.framework 添加到我的项目中,它为我解决了问题。