gpt4 book ai didi

objective-c - 将 AdMob 添加到 IOS cocos2d-x 3.2 时出现链接错误

转载 作者:太空狗 更新时间:2023-10-30 03:38:56 25 4
gpt4 key购买 nike

我正在尝试将 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

并在“其他链接器标志”中添加 -Objcflags后

我收到链接错误:

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)

当我删除 -Objcflags时然后我得到:

<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 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 enter image description here

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

所以你得到了那些错误。

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

MediaPlayer.framework
GameController.framework

关于objective-c - 将 AdMob 添加到 IOS cocos2d-x 3.2 时出现链接错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24844766/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com