Search code examples
iosxcodecocos2d-iphoneapplovin

Apple Mach-O for libAppLovinSdk.a in cocos2d for iPhone


I am trying to display AppLovin sdk in my cocos2d project in Xcode and I'm currently unable to debug this Apple Mach-O error as described below.

Undefined symbols for architecture i386:
  "_CMTimeGetSeconds", referenced from:
      -[ALVideoViewController timeLeft] in libAppLovinSdk.a(ALVideoViewController.o)
      -[ALVideoViewController percentViewed] in libAppLovinSdk.a(ALVideoViewController.o)
  "_CMTimeMakeWithSeconds", referenced from:
      -[ALVideoViewController createCountdownTimeObserver] in libAppLovinSdk.a(ALVideoViewController.o)
  "_MPMoviePlayerPlaybackDidFinishNotification", referenced from:
      ___50-[ALInterstitialViewController prepareForVideoAd:]_block_invoke in libAppLovinSdk.a(ALInterstitialViewController.o)
  "_MPMoviePlayerPlaybackDidFinishReasonUserInfoKey", referenced from:
      ___53-[ALInterstitialViewController moviePlayerDidFinish:]_block_invoke in libAppLovinSdk.a(ALInterstitialViewController.o)
  "_MPMoviePlayerPlaybackStateDidChangeNotification", referenced from:
      ___50-[ALInterstitialViewController prepareForVideoAd:]_block_invoke in libAppLovinSdk.a(ALInterstitialViewController.o)
  "_OBJC_CLASS_$_MPMoviePlayerController", referenced from:
      objc-class-ref in libAppLovinSdk.a(ALInterstitialViewController.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I went to build phases -> add other -> Selected libAppLovinSdk.a file from the finder displayed.

I also set the value of Build Active Architectures only to NO and removed arm64 from architectures. There is no i386 architecture.


Solution

  • You are missing the CoreMedia and MediaPlayer frameworks.

    (I found this out by Googling for CMTimeGetSeconds and MPMoviePlayerPlaybackDidFinishNotification and seeing what section of the Apple docs got hits, however the CM and MP prefixes should be enough to tell you).