# Add the Firebase pod for Google Analytics
pod 'FirebaseAnalytics'
# For Analytics without IDFA collection capability, use this pod instead
# pod FirebaseAnalytics/Core
# Add the pods for any other Firebase products you want to use in your app
# For example, to use Firebase Authentication and Cloud Firestore
pod 'FirebaseAuth'
pod 'FirebaseFirestore'
# Add the pods for the Firebase products you want to use in your app
# For example, to use Firebase Authentication and Cloud Firestore
pod 'FirebaseAuth'
pod 'FirebaseFirestore'
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-05 (世界標準時間)。"],[],[],null,["\u003cbr /\u003e\n\nSwift Package Manager\n\nFirebase recommends Swift Package Manager for new projects.\n\nVia Xcode\n\nSwift Package Manager support requires 16.2 or higher.\n\n1. If migrating from a CocoaPods-based project, run `pod deintegrate` to remove\n CocoaPods from your Xcode project. The CocoaPods-generated `.xcworkspace`\n file can safely be deleted afterward. If you're adding Firebase to a project\n for the first time, this step can be ignored.\n\n2. In Xcode, install the Firebase libraries by navigating to\n **File \\\u003e Add Packages**.\n\n3. In the prompt that appears, select the Firebase GitHub repository:\n\n https://github.com/firebase/firebase-ios-sdk.git\n\n4. Select the version of Firebase you want to use. For new projects, we\n recommend using the newest version of Firebase.\n\n5. Choose the Firebase libraries you want to include in your app.\n\nOnce you're finished, Xcode will begin resolving your package dependencies and\ndownloading them in the background.\n\nVia `Package.swift`\n\nTo integrate Firebase to a Swift package via a `Package.swift` manifest, you can\nadd Firebase to the `dependencies` array of your package. For more details, see\nthe\n[Swift Package Manager documentation](https://docs.swift.org/package-manager/PackageDescription/PackageDescription.html#package-dependency). \n\n dependencies: [\n\n .package(name: \"Firebase\",\n url: \"https://github.com/firebase/firebase-ios-sdk.git\",\n from: \"8.0\"),\n // ...\n\n ],\n\nThen in any target that depends on a Firebase product, add it to the\n[`dependencies` array](https://docs.swift.org/package-manager/PackageDescription/PackageDescription.html#target-dependency)\nof that target. \n\n .target(\n name: \"MyTargetName\",\n dependencies: [\n .product(name: \"FirebaseAuth\", package: \"Firebase\"),\n // ...\n ]\n ),\n\nProduct-specific considerations\n\nSome Firebase products require extra integration steps in order to function\ncorrectly.\n\nGoogle Analytics\n\nGoogle Analytics requires adding the `-ObjC` linker flag to your target's\nbuild settings if included transitively.\n\nCrashlytics\n\nCrashlytics requires you to upload debug symbols.\n\nYou can use a run script build phase for Xcode to automatically upload debug\nsymbols post-build. Find the run script here: \n\n ${BUILD_DIR%Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run\n\nAnother option for uploading symbols is to use the\n[`upload-symbols`](//github.com/firebase/firebase-ios-sdk/raw/master/Crashlytics/upload-symbols)\nscript. Place the script in a subdirectory of your project file (for example\n`scripts/upload-symbols`), then make sure that the script is executable: \n\n chmod +x scripts/upload-symbols\n\nThis script can be used to manually upload dSYM files. For usage notes\nand additional instructions for the script, run `upload-symbols` without any\nparameters.\n\nCocoaPods\n\nFirebase supports installation with\n[CocoaPods](//guides.cocoapods.org/using/getting-started.html#getting-started)\nin addition to Swift Package Manager.\n\nFirebase's CocoaPods distribution requires Xcode 16.2 and\nCocoaPods 1.12.0 or higher. Here's how to install\nFirebase using CocoaPods:\n\n1. Create a Podfile if you don't already have one. From the root of your\n project directory, run the following command:\n\n ```\n pod init\n ```\n | **Note:** Podfiles must include `use_frameworks!` (dynamic linking) or `use_frameworks! :linkage =\u003e :static`; please see the documentation on [linking Firebase dependencies statically or dynamically](/docs/ios/link-firebase-static-dynamic) for more details.\n2. To your Podfile, add the Firebase pods that you want to use in your app.\n\n You can add any of the [supported\n Firebase products](/docs/ios/setup#available-pods) to your app. \n\n Analytics enabled \n\n ```text\n # Add the Firebase pod for Google Analytics\n pod 'FirebaseAnalytics'\n\n # For Analytics without IDFA collection capability, use this pod instead\n # pod FirebaseAnalytics/Core\n\n # Add the pods for any other Firebase products you want to use in your app\n # For example, to use Firebase Authentication and Cloud Firestore\n pod 'FirebaseAuth'\n pod 'FirebaseFirestore'\n ```\n\n Learn more about IDFA, the device-level advertising identifier, in Apple's\n [User Privacy and Data Use](https://developer.apple.com/app-store/user-privacy-and-data-use/)\n and\n [App Tracking Transparency](https://developer.apple.com/documentation/apptrackingtransparency)\n documentation.\n\n Analytics not enabled \n\n ```text\n # Add the pods for the Firebase products you want to use in your app\n # For example, to use Firebase Authentication and Cloud Firestore\n pod 'FirebaseAuth'\n pod 'FirebaseFirestore'\n ```\n | Binary Firebase dependencies are integrated as static frameworks by default. If you're using Firebase as a dependency of a dynamic framework, make sure you read the documentation about [using Firebase from a framework or a library](//github.com/firebase/firebase-ios-sdk/blob/master/docs/firebase_in_libraries.md).\n3. Install the pods, then open your `.xcworkspace` file to see the project in\n Xcode:\n\n ```\n pod install --repo-update\n ``` \n\n ```\n open your-project.xcworkspace\n ```\n\nProduct-specific considerations\n\nSome Firebase products require extra integration steps in order to function\ncorrectly.\n\nCrashlytics\n\nCrashlytics requires you to upload debug symbols.\n\nYou can use a run script build phase for Xcode to automatically upload debug\nsymbols post-build. Find the run script here: \n\n \"${PODS_ROOT}/FirebaseCrashlytics/run\"\n\nCarthage\n\nCarthage support is experimental. See the\n[instructions on GitHub](https://github.com/firebase/firebase-ios-sdk/blob/master/Carthage.md)\nfor including Firebase in your app via Carthage.\n\nIntegrate manually\n\nFirebase provides a pre-built binary XCFramework distribution for users who want\nto integrate Firebase without using a dependency manager. To install Firebase:\n\n1. Download the [framework SDK zip](/download/ios). This file contains architecture slices\n for all available target architectures for all Firebase SDKs and thus may\n take some time to download.\n\n2. Unzip the file, then review the `README` for the frameworks that you want to\n include in your app.\n\n3. Add the [`-ObjC` linker\n flag](//developer.apple.com/library/content/qa/qa1490/_index.html) in your\n `Other Linker Settings` in your target's build settings."]]