按一下 + 按鈕,然後為反向用戶端 ID 新增網址架構。如要找出這個值,請開啟GoogleService-Info.plist設定檔,然後尋找 REVERSED_CLIENT_ID 鍵。複製該金鑰的值,然後貼到設定頁面的「URL Schemes」(網址架構) 方塊中。將其他欄位留空。
按一下「+」按鈕,然後新增第二個網址架構。這個 ID 與應用程式的軟體包 ID 相同。舉例來說,如果您的套件 ID 是
com.example.ios,請在「網址架構」方塊中輸入該值。
您可以在專案設定的「一般」分頁中找到應用程式的軟體包 ID (「Identity」>「Bundle Identifier」)。
使用 Firebase 控制台
如要產生單一 Dynamic Link (無論是為了測試,或是讓行銷團隊輕鬆建立連結,以便用於社群媒體貼文等),最簡單的方法就是前往 Firebase 控制台,然後按照逐步表單手動建立。
自訂網域
使用自己的網域,而非 goo.gl 或 page.link 子網域,可進一步控管 Dynamic Link 的品牌宣傳。請按照這些操作說明,為專案設定自訂網域。
if(result.status()==firebase::kFutureStatusComplete){if(result.error()==firebase::dynamic_links::kErrorCodeSuccess){firebase::dynamic_links::GeneratedDynamicLinklink=*result.result();printf("Create short link succeeded: %s\n",link.url.c_str());}else{printf("Created short link failed with error '%s'\n",result.error_message());}}
[[["容易理解","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\n| **Note:** Firebase Dynamic Links is *deprecated* and should not be used in new projects. The service will be shutting down soon. Follow the [migration guide](/support/dynamic-links-faq#how_should_i_migrate_from_the_service) and see the [Dynamic Links Deprecation FAQ](/support/dynamic-links-faq) for more information.\n\nYou can create short or long Dynamic Links with the Firebase Dynamic Links API. The API\ntakes several optional parameter structures to build links. Short links can\nalso be created from a previously generated long link. Firebase Dynamic Links\ngenerates a URL like the following: \n\n https://example.page.link/WXYZ\n\nThe C++ SDK works for both Android and iOS, with some additional setup required\nfor each platform.d\n\nBefore you begin\n\nBefore you can use\n[Firebase Dynamic Links](/docs/reference/unity/namespace/firebase/dynamic-links),\nyou need to:\n\n- Register your C++ project and configure it to use Firebase.\n\n If your C++ project already uses Firebase, then it's already registered and\n configured for Firebase.\n- Add the [Firebase C++ SDK](/download/cpp) to your C++ project.\n\n| **Find detailed instructions for these initial\n| setup tasks in\n| [Add Firebase to your C++\n| project](/docs/cpp/setup#note-select-platform).**\n\nNote that adding Firebase to your C++ project involves tasks both in the\n[Firebase console](//console.firebase.google.com/) and in your open C++ project (for example, you download\nFirebase config files from the console, then move them into your C++ project). \n\nAndroid\n\n1. In the Firebase console, open the **Dynamic Links** section.\n2. If you have not already accepted the terms of service and set a URI\n prefix for your Dynamic Links, do so when prompted.\n\n If you already have a Dynamic Links URI prefix, take note of it. You need\n to provide a Dynamic Links URI prefix when you programmatically create\n Dynamic Links.\n\n3. **Recommended** : Specify the URL patterns allowed in your deep links and fallback links. By doing so, you prevent unauthorized parties from creating Dynamic Links that redirect from your domain to sites you don't control. See [Allow specific URL patterns](/docs/dynamic-links/allow-specific-url-patterns).\n\niOS\n\n1. In the Firebase console, open the **Dynamic Links** section.\n2. If you have not already accepted the terms of service and set a URI\n prefix for your Dynamic Links, do so when prompted.\n\n If you already have a Dynamic Links URI prefix, take note of it. You need\n to provide a Dynamic Links domain when you programmatically create\n Dynamic Links.\n\n3. The Firebase Dynamic Links C++ client library uses custom URL schemes on iOS to process links. You must add custom URL schemes to your app to support receiving Dynamic Links:\n 1. To open your project configuration, double-click the project name in the left tree view. Select your app from the **TARGETS** section, then select the **Info** tab, and expand the **URL Types** section.\n 2. Click the **+** button, and add a URL scheme for your reversed client ID. To find this value, open the GoogleService-Info.plist configuration file, and look for the `REVERSED_CLIENT_ID` key. Copy the value of that key, and paste it into the **URL Schemes** box on the configuration page. Leave the other fields blank.\n 3. Click the **+** button, and add a second URL scheme. This one is the same as your app's bundle ID. For example, if your bundle ID is `com.example.ios`, type that value into the **URL Schemes** box. You can find your app's bundle ID in the **General** tab of the project configuration (**Identity \\\u003e Bundle Identifier**).\n\n| **Note:** Dynamic Links is not supported on tvOS.\n\nUse the Firebase console\n\nIf you want to generate a single Dynamic Link, either for testing purposes, or for your marketing team\nto easily create a link that can be used in something like a social media post, the simplest way would\nbe to visit the [Firebase console](https://console.firebase.google.com/project/_/durablelinks/links/)\nand create one manually following the step-by-step form.\n\nCustom domains\n\nYou can have greater control over your Dynamic Link's branding by using your own\ndomain instead of a `goo.gl` or `page.link` subdomain. Follow [these\ninstructions](/docs/dynamic-links/custom-domains) to set up a custom domain for\nyour project.\n| **Note:** If you're building your project for iOS, you must edit the `Info.plist` file per the [iOS-only instructions](/docs/dynamic-links/custom-domains#console) for setting up a custom domain.\n\nUsing the Firebase Dynamic Links API\n\nCreate and initialize App\n\nBefore you can create Dynamic Links, you'll need to create and initialize\na [`firebase::App`](/docs/reference/cpp/class/firebase/app) object.\n| You only need to initialize firebase::App once, no matter how many Firebase C++ features you use.\n\nInclude the header file for `firebase::App`: \n\n```c++\n#include \"firebase/app.h\"\n```\n\nThe next part varies depending on your platform: \n\nAndroid\n\n\nCreate the `firebase::App`, passing the JNI environment and a `jobject`\nreference to the Java Activity as arguments: \n\n```c++\napp = ::firebase::App::Create(::firebase::AppOptions(\"APPLICATION NAME\"), jni_env, activity);\n```\n\niOS\n\n\nCreate the `firebase::App`: \n\n```c++\napp = ::firebase::App::Create(::firebase::AppOptions(\"APPLICATION NAME\"));\n```\n\nInitialize Dynamic Links library\n\nBefore creating a Dynamic Link, you must first\n[initialize](/docs/reference/cpp/namespace/firebase/dynamic-links#initialize)\nthe Dynamic Links library: \n\n```c++\n::firebase::dynamic_links::Initialize(app, null);\n```\n\n\u003cbr /\u003e\n\nCreating a long Dynamic Link from parameters\n\nTo create a Dynamic Link, create a DynamicLinkComponents object, setting any of\nthe optional members for additional configuration, and passing it to\n`dynamic_links::GetShortLink` or `dynamic_links::GetLongLink`.\n\nThe following minimal example creates a long Dynamic Link to\nhttps://www.example.com/ that opens with your Android app\ncom.example.android.package_name and iOS app com.example.ios: \n\n```c++\nfirebase::dynamic_links::IOSParameters ios_parameters(\"com.example.ios\");\n\nfirebase::dynamic_links::AndroidParameters android_parameters(\n \"com.example.android.package_name\");\n\nfirebase::dynamic_links::DynamicLinkComponents components(\n \"https://www.example.com/\", \"example.page.link\");\ncomponents.android_parameters = &android_parameters;\ncomponents.ios_parameters = &ios_parameters;\n\nfirebase::dynamic_links::GeneratedDynamicLink long_link =\n firebase::dynamic_links::GetLongLink(components);\n```\n| **Note:** Long Links append all of the configuration settings as query arguments to the link and therefore do not require any network calls.\n\nCreating a short Dynamic Link\n\nTo create a short Dynamic Link, pass a previously generated long link to\n`GetShortLink` or build `DynamicLinkComponents` the same way as above.\n\n`GetShortLink` optionally takes an extra `DynamicLinkOptions` config\nparameter with `PathLength`; this allows you to control how the link should be\ngenerated. Generating a short link requires a network request to the Firebase\nbackend, so `GetShortLink` is asynchronous, returning a `Future\u003cGeneratedLink\u003e`.\n\nFor example: \n\n```c++\nfirebase::dynamic_links::DynamicLinkOptions short_link_options;\nshort_link_options.path_length = firebase::dynamic_links::kPathLengthShort;\n\nfirebase::Future\u003cfirebase::dynamic_links::GeneratedDynamicLink\u003e result =\n firebase::dynamic_links::GetShortLink(components, short_link_options);\n```\n\nIf your program has an update loop that runs regularly (say at 30 or 60 times\nper second), you can check the results once per update: \n\n```c++\nif (result.status() == firebase::kFutureStatusComplete) {\n if (result.error() == firebase::dynamic_links::kErrorCodeSuccess) {\n firebase::dynamic_links::GeneratedDynamicLink link = *result.result();\n printf(\"Create short link succeeded: %s\\n\", link.url.c_str());\n } else {\n printf(\"Created short link failed with error '%s'\\n\",\n result.error_message());\n }\n}\n```"]]