将AdMob添加到IOS cocos2d-x 3.2时出现链接错误 [英] Linking errors when adding AdMob to IOS cocos2d-x 3.2
问题描述
我试图按照
中的教程,使用Xcode 5.1 iOS 7.1将AdMob添加到cocos2d-x 3.2简单游戏中
i > https://developers.google.com/mobile-ads-sdk/docs/#ios
和
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->将二进制文件与库链接
Solution: Just add following frameworks BuildSettings -> Build Phase -> Link Binary with libraries
MediaPlayer.framework
GameController.framework
这篇关于将AdMob添加到IOS cocos2d-x 3.2时出现链接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!