简体   繁体   中英

AdMob libarary in iOS cause linker error(mach-o)

I make some game with cocos2d-x game library and I want to show banner ad with AdMob. With libGoogleAdMobAds.a version 6.5.0, it works fine but that version did not support arm64 architecture. And then I migrate to version 6.11.1(latest version) but it cause some linker error.

Undefined symbols for architecture armv7: "_UITransitionContextToViewControllerKey" "_UITransitionContextFromViewControllerKey" "_OBJC_METACLASS_$_UIPercentDrivenInteractiveTransition" "_OBJC_CLASS_$_UIPercentDrivenInteractiveTransition" linker command failed with exit code 1 (use -v to see invocation)

What is the problem? I spent for 3 day because this error. please help me.


Below is whole error message.

Undefined symbols for architecture armv7: "_UITransitionContextToViewControllerKey", referenced from: -[GADViewControllerFullScreenSwipeAnimation animateTransition:] in libGoogleAdMobAds.a(GADViewControllerFullScreenSwipeAnimation.o) -[GADViewControllerFullScreenSwipeAnimation animationContextForTopToBottomAnimationPresentationWithTransitionContext:] in libGoogleAdMobAds.a(GADViewControllerFullScreenSwipeAnimation.o) -[GADViewControllerFullScreenSwipeAnimation animationContextForBottomToTopAnimationPresentationWithTransitionContext:] in libGoogleAdMobAds.a(GADViewControllerFullScreenSwipeAnimation.o) "_UITransitionContextFromViewControllerKey", referenced from: -[GADViewControllerFullScreenSwipeAnimation animateTransition:] in libGoogleAdMobAds.a(GADViewControllerFullScreenSwipeAnimation.o) -[GADViewControllerFullScreenSwipeAnimation animationContextForRestoringAnimationToSavedState:] in libGoogleAdMobAds.a(GADViewControllerFullScreenSwipeAnimation.o) "_OBJC_METACLASS_$_UIPercentDriven InteractiveTransition", referenced from: _OBJC_METACLASS_$_GADPercentDrivenUserInteractionAnimationController in libGoogleAdMobAds.a(GADPercentDrivenUserInteractionAnimationController.o) "_OBJC_CLASS_$_UIPercentDrivenInteractiveTransition", referenced from: _OBJC_CLASS_$_GADPercentDrivenUserInteractionAnimationController in libGoogleAdMobAds.a(GADPercentDrivenUserInteractionAnimationController.o) ld: symbol(s) not found for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Check in your Targets->Build Phases-> Link Binary With Labraries is libGoogleAdMobAds added? If yes, than check if all required frameworks for working with AdMob are added!

也许您应该查看AdMob最新版本的文档,某些方法可能已被不推荐使用,并且在最新版本中已删除,并且可能不再可用?

You're probably not going to like this answer, but it worked for me :)

I was getting the exact same error as you. When I plug in an iOS device, Xcode lists the device 3 times in the device list. On my other apps, I've always chosen to execute on the middle one. When using AdMob, I have to select the third one in the list or I get the linker error.

If Xcode does the same thing for you, give it a try.

Since I have no idea why Xcode lists 3 devices or why the target device changes compilation, I'll be testing my build on a number of iOS devices!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM