docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Get started with iOS Resolver

    Configure and use the iOS Resolver to add Swift Package and CocoaPod dependencies to your Xcode project.

    Use the iOS Resolver to resolve iOS specific dependencies in your project. The iOS Resolver supports Swift Packages and CocoaPods.

    Swift Package Manager support

    Use Swift Packages to add iOS dependencies. External Dependency Manager (EDM) uses Unity's support for adding packages to the generated Xcode project, based on each library's Dependencies XML file.

    For example, to add the Firebase Analytics package:

    <dependencies>
      <remoteSwiftPackage url="https://github.com/firebase/firebase-ios-sdk.git" version="12.0.0">
        <swiftPackage name="FirebaseAnalytics"/>
      </remoteSwiftPackage>
    </dependencies>
    

    Replace CocoaPods

    In the Dependencies.xml files, a library can declare both Swift Packages and CocoaPods. This allows you to fall back to CocoaPods when needed. List which CocoaPods the Swift package replaces so resolution adds only one of them.

    For example:

    <dependencies>
      <remoteSwiftPackage url="https://github.com/googleads/swift-package-manager-google-mobile-ads.git" version="12.12.0" upToNextMajor="true">
        <swiftPackage name="GoogleMobileAds" replacesPod="Google-Mobiles-Ads-SDK"/>
      </remoteSwiftPackage>
    </dependencies>
    

    CocoaPods support

    Unity generates a CocoaPods Podfile and runs the pod tool after the build to add dependencies to the exported Xcode project. Declare iOS pods in your dependency XML.

    For example, to add the AdMob pod version 7.0 or greater with bitcode enabled:

    <dependencies>
      <iosPods>
        <iosPod name="Google-Mobile-Ads-SDK" version="~> 7.0" bitcodeEnabled="true" minTargetSdk="6.0" addToAllTargets="false" />
      </iosPods>
    </dependencies>
    

    Integrate CocoaPods

    You can integrate CocoaPods in two ways:

    • Xcode Project integration: Add CocoaPods to the .xcodeproj directly without creating a separate xcworkspace.
    • Xcode workspace integration: If your Unity version supports opening an xcworkspace, the pod tool can generate a workspace that references CocoaPods.

    Change the resolution strategy from the Assets > External Dependency Manager > iOS Resolver > Settings > CocoaPods Integration.

    Append text to the generated Podfile

    To modify the generated Podfile, create a script file such as the following example:

    using System.IO;
    using UnityEditor;
    using UnityEditor.Callbacks;
    using UnityEngine;
    
    public class PostProcessIOS
    {
        // Must be between 40 and 50 to ensure that it's not overridden by Podfile generation (40) and
        // that it's added before "pod install" (50).
        [PostProcessBuildAttribute(45)]
        private static void PostProcessBuild_iOS(BuildTarget target, string buildPath)
        {
            if (target == BuildTarget.iOS)
            {
                using (StreamWriter sw = File.AppendText(buildPath + "/Podfile"))
                {
                    // For example, add an app extension
                    sw.WriteLine("\ntarget 'NSExtension' do\n  pod 'Firebase/Messaging', '6.6.0'\nend");
                }
            }
        }
    }
    

    Additional resources

    • iOS Resolver settings reference
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)