2014-07-19 30 views
4

我嘗試添加的AdMob使用的Xcode 5.1的iOS到的Cocos2D-X 3.2簡單的遊戲
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鏈接錯誤添加AdMob,在IOS時的Cocos2D-X 3.2

教程

,並在「其它鏈接器標記」

我收到鏈接錯誤添加-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) 

當我取出-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. 

這裏有什麼問題?

+0

我會建議使用plugin-x – aviran

+0

你是什麼意思,有沒有任何現成的插件爲admob iOS? – user63898

+0

是的,它被稱爲plugin-x,它帶有cocos2d-x,google它。 – aviran

回答

1

是的原因是添加了-ObjC標誌用於AdMob支持。我已經將MediaPlayer.framework添加到我的項目中,併爲我解決了問題。

27

-ObjC載荷實現一個Objective-C類或類別靜態歸檔庫的所有成員。(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 - >構建階段 - >鏈接二進制與圖書館

MediaPlayer.framework 
GameController.framework 
+0

謝謝Jasio。爲了清楚起見,框架應該添加到您的項目中,而不是添加到cocos中 –

+1

就像爲那些集成soomla cocos2dx存儲框架的人一樣。這也可能有幫助。 –

+0

這對我工作感謝! @ user63898您應該將其標記爲已接受的答案。 –

0

的AdMob的iOS SDK 7.0版發佈作爲一個框架。如果您使用它,則不需要添加-ObjC鏈接器選項和額外的依賴項。它也針對iOS 8.0進行了優化。如果切換到7.0,所有鏈接錯誤將消失。