Firebase'i C++ projenize eklemenin hem Firebase konsolda hem de açık C++ projenizde görevler içerdiğini unutmayın (örneğin, Firebase yapılandırma dosyalarını konsoldan indirip C++ projenize taşırsınız).
Özel URL şemaları ekleme (yalnızca iOS için)
Firebase Dynamic Links C++ istemci kitaplığı, bağlantıları işlemek için iOS'te özel URL şemaları kullanır. Dynamic Links almayı desteklemek için uygulamanıza özel URL şemaları eklemeniz gerekir.
Proje yapılandırmanızı açmak için soldaki ağaç görünümünde proje adını çift tıklayın.
HEDEFLER bölümünden uygulamanızı, ardından Bilgi sekmesini seçin.
Ardından URL Türleri bölümünü genişletin.
+ düğmesini tıklayın ve tersine çevrilmiş istemci kimliğiniz için bir URL şeması ekleyin. Bu değeri bulmak için:
GoogleService-Info.plist yapılandırma dosyasını açın ve REVERSED_CLIENT_ID anahtarını bulun.
Bu anahtarın değerini kopyalayın ve yapılandırma sayfasındaki URL Şemaları kutusuna yapıştırın.
Diğer alanları boş bırakın.
+ düğmesini tıklayın ve ikinci bir URL şeması ekleyin. Bu, uygulamanızın paket kimliğiyle aynıdır.
Örneğin, paket kimliğiniz com.example.ios ise bu değeri URL Şemaları kutusuna girin.
Uygulamanızın paket kimliğini, proje yapılandırmasının Genel sekmesinde (Kimlik > Paket Kimliği) bulabilirsiniz.
Dynamic Link alma
Uygulama oluşturma ve başlatma
Alınan Dynamic Links olup olmadığını kontrol edebilmek için önce bir firebase::App nesnesi oluşturup başlatmanız gerekir.
firebase::App için başlık dosyasını ekleyin:
#include"firebase/app.h"
Sonraki bölüm, platformunuza göre değişir:
Android
JNI ortamını ve Java etkinliğine yönelik bir jobject referansını bağımsız değişken olarak ileterek firebase::App oluşturun:
Dynamic Links almak için Listener sınıfınızın OnDynamicLinkReceived sanal işlevini uygulaması gerekir. Yöntemi geçersiz kılarak, alınmışsa derin bağlantı alabilirsiniz.
classListener:publicfirebase::dynamic_links::Listener{public:// Called on the client when a dynamic link arrives.voidOnDynamicLinkReceived(constfirebase::dynamic_links::DynamicLink*dynamic_link)override{printf("Received link: %s",dynamic_link->url.c_str());}};
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2025-09-05 UTC."],[],[],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\nTo receive the Firebase Dynamic Links that [you created](/docs/dynamic-links/create-links),\nyou must include the Dynamic Links SDK in your app and create a\n[`firebase::dynamic_links::Listener`](/docs/reference/cpp/class/firebase/dynamic-links/listener)\nobject that implements the\n[`OnDynamicLinkReceived`](/docs/reference/cpp/class/firebase/dynamic-links/listener#ondynamiclinkreceived)\nvirtual function.\n\nThe C++ SDK works for both Android and iOS, with some additional setup required\nfor each platform.\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\nAdd custom URL schemes (for iOS only)\n\nThe Firebase Dynamic Links C++ client library uses custom URL schemes on iOS to\nprocess links. You must add custom URL schemes to your app to support receiving\nDynamic Links.\n\n1. To open your project configuration, double-click the project name in the left\n tree view.\n\n2. Select your app from the **TARGETS** section, then select the **Info** tab,\n then expand the **URL Types** section.\n\n3. Click the **+** button, then add a URL scheme for your reversed client ID. To\n find this value:\n\n 1. Open the GoogleService-Info.plist configuration file, then look for the\n `REVERSED_CLIENT_ID` key.\n\n 2. Copy the value of that key, then paste it into the **URL Schemes** box on\n the configuration page.\n\n 3. Leave the other fields blank.\n\n4. Click the **+** button, then add a second URL scheme. This one is the same as\n your app's bundle ID.\n\n For example, if your bundle ID is `com.example.ios`, type that value into the\n **URL Schemes** box.\n\n You can find your app's bundle ID in the **General** tab of the project\n configuration (**Identity \\\u003e Bundle Identifier**).\n\nReceiving a Dynamic Link\n\nCreate and initialize App\n\nBefore you can check for received 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\nImplement Listener to check for Dynamic Links\n\nTo check for a received Dynamic Link, implement and use the\n[`firebase::dynamic_links::Listener`](/docs/reference/cpp/class/firebase/dynamic-links/listener)\nclass.\n\nInclude the header file for receiving Dynamic Links: \n\n```c++\n#include \"firebase/dynamic_links.h\"\n```\n\n\u003cbr /\u003e\n\n[Initialize](/docs/reference/cpp/namespace/firebase/dynamic-links#initialize) the Dynamic Links library: \n\n```c++\n::firebase::dynamic_links::Initialize(app, null);\n```\n\n\u003cbr /\u003e\n\nCreate an object that implements\n[`firebase::dynamic_links::Listener`](/docs/reference/cpp/class/firebase/dynamic-links/listener),\nand supply it to the Dynamic Links library with\n[`SetListener()`](/docs/reference/cpp/namespace/firebase/dynamic-links#setlistener),\nor pass it as the second argument to\n[Initialize](/docs/reference/cpp/namespace/firebase/dynamic-links#initialize).\n\nTo receive Dynamic Links, your Listener class must implement the\n[`OnDynamicLinkReceived`](/docs/reference/cpp/class/firebase/dynamic-links/listener#ondynamiclinkreceived)\nvirtual function. By overriding the method, you can receive a deep link, if\none was received. \n\n```c++\nclass Listener : public firebase::dynamic_links::Listener {\n public:\n // Called on the client when a dynamic link arrives.\n void OnDynamicLinkReceived(\n const firebase::dynamic_links::DynamicLink* dynamic_link) override {\n printf(\"Received link: %s\", dynamic_link-\u003eurl.c_str());\n }\n};\n```\n| **Note:** On Android you must also call [`Fetch()`](/docs/reference/cpp/namespace/firebase/dynamic-links#fetch) when the application gains focus in order for the listener to be triggered."]]