IOS cocos2d-x 3.2添加AdMob时链接错误 [英] Linking errors when adding AdMob to IOS cocos2d-x 3.2
问题描述
我正在尝试将 AdMob 添加到 cocos2d-x 3.2 简单游戏
使用 Xcode 5.1 iOS 7.1
我按照教程https://developers.google.com/mobile-ads-sdk/docs/#ios
和http://plaincode.blogspot.co.il/2014/02/example-of-admob-integration-in-cocos2d.html
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
在其他链接器标志"中添加 -ObjC 标志后
and after adding the -ObjC flag in the "Other Linker Flags"
我收到链接错误:
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)
当我删除 -ObjC 标志时然后我得到:
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.
这里有什么问题?
推荐答案
-ObjC 加载实现 Objective-C 类或类别的静态归档库的所有成员.(https://developer.apple.com/library/mac/qa/qa1490/_index.html)
-ObjC Loads all members of static archive libraries that implement an Objective-C class or category.(https://developer.apple.com/library/mac/qa/qa1490/_index.html)
在 cocos2d-x 3.2
In cocos2d-x 3.2
CCController-iOS.mm -> #import <GameController/GameController.h>
UIVideoPlayerIOS.mm ->#import <MediaPlayer/MediaPlayer.h>
CCController-iOS.mm -> #import <GameController/GameController.h>
UIVideoPlayerIOS.mm ->#import <MediaPlayer/MediaPlayer.h>
所以你得到了这些错误.
so you got those errors.
解决方案:只需添加以下框架 BuildSettings -> Build Phase -> Link Binary with libraries
Solution: Just add following frameworks BuildSettings -> Build Phase -> Link Binary with libraries
MediaPlayer.framework
GameController.framework
这篇关于IOS cocos2d-x 3.2添加AdMob时链接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!