# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'YourProject' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for YourProject
pod 'Firebase'
# Remove the default InAppMessaging pod:
# pod 'Firebase/InAppMessaging'
# Overwrite it with a version that points to your local copy:
pod `FirebaseInAppMessaging', :path => '~/Path/To/The/Cloned/Repo/'
end
[[["易于理解","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"]],["最后更新时间 (UTC):2025-09-03。"],[],[],null,["\u003cbr /\u003e\n\niOS+ Android Flutter \n\n\u003cbr /\u003e\n\nFirebase In-App Messaging provides a useful set of preconfigured behaviors and\nmessage types with a default look and feel, but in some cases you may want to\nextend behaviors and message content. In-App Messaging allows you to add actions\nto messages and customize message look and feel.\n\nAdd an action to your message\n\nWith actions you can use your in-app messages to direct users to a\nwebsite or a specific screen in your app.\n\nImplement a deep link handler\n\nFirebase In-App Messaging uses link handlers to process actions. The SDK\nis able to use a number of handlers, so if your app already has one, Firebase In-App Messaging\ncan use that without any further setup. If you don't yet\nhave a handler, you can use Firebase Dynamic Links. To learn more, read\n[Create Dynamic Links on iOS](/docs/dynamic-links/ios/create).\n\nAdd the action to your message using the Firebase console\n\nOnce your app has a link handler, you're ready to compose a campaign with\nan action. Open the Firebase console to\n[Messaging](//console.firebase.google.com/project/_/messaging),\nand start a new campaign or edit an existing campaign. In that campaign, provide\na **Card** , **Button text** and **Button action** , an **Image action** , or a **Banner\naction**, where the action is a relevant deep link.\n\nThe action's format depends on which message layout you choose. Modals get\naction buttons with customizable button text content, text color, and background\ncolor. Images and top banners, on the other hand, become interactive and invoke\nthe specified action when tapped.\n\nModify message look and feel\n\nFirebase In-App Messaging lets you customize message displays to change the way your app renders\nmessages' layout, font styles, button shapes, and other details. There are two\nways to modify message displays: modify the default Firebase In-App Messaging\ndisplays or create your own message display library from scratch. \n**Note:** This product is not available on macOS, Mac Catalyst, App Clip or watchOS targets.\n\nModify default displays\n\nThe most straightforward way customize your messages is to build off of\nFirebase In-App Messaging's default message display code.\n\nClone the `firebase-ios-sdk` repo\n\nTo get started, clone the [latest release](//github.com/firebase/firebase-ios-sdk/releases/latest)\nof the `firebase-ios-sdk` repo, and open the\n[InAppMessaging directory](//github.com/firebase/firebase-ios-sdk/tree/master/FirebaseInAppMessaging).\n\nSelect message types to modify\n\nWith the repo cloned, you can modify any or all of the Firebase In-App Messaging message types:\n`Card`, `Modal`, `Banner`, and `ImageOnly`. Each type corresponds to a\nmessage layout in the Firebase In-App Messaging campaign creation flow.\n\nAccordingly, each type has access to a different set of data, determined by\ncampaign customization options in the Firebase console:\n\n| Type | titleText | bodyText | textColor | backgroundColor | imageData | actionButton | secondaryActionButton |\n|-----------|-----------|----------|-----------|-----------------|-----------|--------------|-----------------------|\n| Card | check | check | check | check | check | check | check |\n| Modal | check | check | check | check | check | check | |\n| Banner | check | check | check | check | check | | |\n| ImageOnly | | | | | check | | |\n\nModify the message display rendering code\n\nWith the message type limitations in mind, you're free to modify them however\nyou'd like. You can create a banner that displays at the bottom of your app,\nmove around the action button on a modal, embed the in-app message in a user's\nfeed, or any other modification that would make the messages' look and feel fit\nyour app.\n\nThere are two main things to pay attention to when modifying message displays:\n\n- **Message type directories:** Each message type has a separate directory with files that determine that type's logic:\n - [`Card`](//github.com/firebase/firebase-ios-sdk/tree/master/FirebaseInAppMessaging/Sources/DefaultUI/Card)\n - [`Modal`](//github.com/firebase/firebase-ios-sdk/tree/master/FirebaseInAppMessaging/Sources/DefaultUI/Modal)\n - [`Banner`](//github.com/firebase/firebase-ios-sdk/tree/master/FirebaseInAppMessaging/Sources/DefaultUI/Banner)\n - [`ImageOnly`](//github.com/firebase/firebase-ios-sdk/tree/master/FirebaseInAppMessaging/Sources/DefaultUI/ImageOnly)\n- **Storyboard:** The `InAppMessaging` library also has a `.storyboard` file that helps define the UI for all three message types:\n - [`FIRInAppMessageDisplayStoryboard.storyboard`](//github.com/firebase/firebase-ios-sdk/tree/master/FirebaseInAppMessaging/iOS/Resources/)\n\nModify files in your preferred message types' directories and the corresponding\nsections of the `.storyboard` to create your custom message displays.\n\nUpdate your podfile to use your modified `InAppMessaging` code\n\nTo get Firebase In-App Messaging to use your modified message displays instead of the default\ndisplays, update your podfile to use your customized `InAppMessaging` library: \n\n```scdoc\n# Uncomment the next line to define a global platform for your project\n# platform :ios, '9.0'\n\ntarget 'YourProject' do\n# Comment the next line if you're not using Swift and don't want to use dynamic frameworks\nuse_frameworks!\n\n# Pods for YourProject\npod 'Firebase'\n\n# Remove the default InAppMessaging pod:\n# pod 'Firebase/InAppMessaging'\n\n# Overwrite it with a version that points to your local copy:\npod `FirebaseInAppMessaging', :path =\u003e '\u003cvar translate=\"no\"\u003e~/Path/To/The/Cloned/Repo/\u003c/var\u003e'\n\nend\n```\nWith that done, you can update your pods, rebuild your app, and see your new, customized message displays.\n\n\u003cbr /\u003e\n\nCreate your own message display library\n\nYou're not limited to working from the `InAppMessaging` library to create\na UI for displaying messages. You can also write your own code from scratch.\n\nBuild a class that implements the `InAppMessagingDisplay` protocol **Note:** In Objective-C, all types are prefixed with `FIR` to avoid class name collisions.\n\nFirebase In-App Messaging uses the `InAppMessaging` class to handle communications between\nFirebase servers and your app. That class, in turn, uses the\n`InAppMessagingDisplay` protocol to display the messages it receives.\nTo build your own display library, write a class that implements the protocol.\n\nThe protocol definition and documentation on how to conform to it are in the\n`FIRInAppMessagingDisplay.h` file of the `InAppMessaging` library.\n| **Tip: Use the `InAppMessaging` code\n| for reference.** Even if you're not building with it directly, you'll probably find it helpful to take a look at the default Firebase In-App Messaging message displays to get a feel for how they implement `InAppMessagingDisplay`. You can find them in the [Firebase Apple platforms SDK GitHub repo](//github.com/firebase/firebase-ios-sdk/tree/master/FirebaseInAppMessaging/).\n\nSet `messageDisplayComponent` to use your message display library\n\n`InAppMessaging` uses its\n[`messageDisplayComponent`](/docs/reference/swift/firebaseinappmessaging/api/reference/Classes/InAppMessaging#messagedisplaycomponent)\nproperty to determine which object\nto use when displaying messages. Set that property to an object of your custom\nmessage display class, so Firebase In-App Messaging knows to use your library to render messages: \n\n```text\nInAppMessaging.inAppMessaging().messageDisplayComponent = yourInAppMessagingRenderingInstance\n```"]]