skip to Main Content

We make middleware using Cordova and AdMob to show ads. Cordova generates an Xcode project for us. However the resulting Xcode projects now fail to build with the error ld: framework not found UserMessagingPlatform.xcframework.

This appears to be caused by the Google UMP SDK updating to version 1.3.0, which notes "Updated the SDK from a .framework to a .xcframework." I’ve contacted AdMob support, and they claim the build works for them and haven’t provided any useful help.

I have no idea why our builds now fail and I’m at a loss as to what to do about it. Here is a sample Xcode project: https://www.dropbox.com/s/y1ly2c3yi45rop6/TestBuild.ios.project.zip?dl=0

Can anyone identify what has gone wrong with this Xcode project causing it to fail to build, and identify a workaround?

3

Answers


  1. Are you using Cocoapods for your XCode project?

    This stackoverflow answer suggest updating cocoapods

    Try updating cocoapods:

    sudo gem install cocoapods
    

    Cocoapods changelog contains fixes for XCFrameworks

    Login or Signup to reply.
  2. The Issue

    The issue appears to be that a framework/dependency is not added to the Xcode project, so it doesn’t have the code necessary to compile the application. AdMob relies on that UserMessagingPlatform thing to work, and without the Mobile Ads SDK being present in your codebase, UserMessagingPlatform is missing and your application is essentially asking for code that isn’t there. To resolve this, you have to tell cocoapods (a dependency manager, think npm but for Swift/Objective-C) to locate and add the missing code to your project.

    First, install cocoapods if you haven’t already. I used Homebrew to do this, as it seems to be the only method that worked without headache. Many people already have Homebrew, but if you don’t, install that first, then run:
    brew install cocoapods

    Next, go into your project directory using the Terminal. Once you’re in the directory, run:
    pod install --repo-update

    Reopen your project in Xcode, and it should compile successfully now.

    Step by step resolution:

    Skip any steps that aren’t necessary for your environment.

    1. Install Homebrew: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
    2. Install cocoapods: brew install cocoapods
    3. Open a terminal, navigate to your project directory: cd /path/to/your/project
    4. Update dependencies: pod install --repo-update

    Disclaimer: I’m not a Swift or Objective-C developer, and my experience with Apple/Xcode is limited. I also am unfamiliar with "cocoapods" and AdMob. I just downloaded the sample code and worked through the issue until I got it to compile successfully.

    Login or Signup to reply.
  3. .xcframework files can only be used on CocoaPods 1.10.0 or newer, in your sample app you were using 1.8.4.

    Update CocoaPods to latest and run pod install again.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search