Skip to content

dikadk/Juce-Firebase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Juce-Firebase

How to integrate Firebase C++ SDK into iOS JUCE app

Based on https://forum.juce.com/t/juce-firebase-admob-lets-monetize-our-juce-ios-apps-with-ads-partial-how-to/29369/5 and https://www.youtube.com/watch?v=vBaQaqaJjZ8

But due to changes in latest Firebase iOS SDK. Tutorial required some additional steps.

This tutorial will show how to setup Analytics and Crashlytics

Pre-requisites

Last tested JAN 2023 Update

https://github.com/firebase/firebase-ios-sdk/releases/tag/10.20.0

https://github.com/firebase/firebase-cpp-sdk/releases/tag/v11.8.0

Tested libraries: Analytics Crashlitics Push Notifications

-----------------------

  1. Download Firebase C++ SDK
  2. Download Firebase iOS Frameworks Zip ~1gb (https://firebase.google.com/docs/ios/setup)
  3. Build custom Projucer from Source.

New Firebase iOS SDK consists of .framework and .xcframework. Bundled Juce Projucer version has few issues with .xcframework.

So we have to make few changes to Xcode Exporter and build Projucer from Source. jucer_ProjectExport_Xcode.h:

  1. Comment out line: writeWorkspaceSettings(); (This will ensure that once we change build system in Xcode to NEW BUILD SYSTEM, it won't reset to Legacy on saving project. We have to use NEW BUILD system in XCode to use .xcframewoks)
  2. Ignore addition of .framework extention to .xcframework paths
String addCustomFramework(String frameworkPath){
          if (! frameworkPath.endsWithIgnoreCase (".framework") && !frameworkPath.endsWithIgnoreCase(".xcframework"))
          frameworkPath << ".framework";
          ...
 }

This will ensure that we will be able to specify extension in Extra Custom Frameworks field in Project (aka. path/FirebaseAnAlytics.xcframework) 3. Build Projucer and open Juce Project using it

Project Config:

  1. Setup Firebase project
  2. Download GoogleServices-Info.plist into Source folder and add to project ass 'Xcode Resource'
  3. Edit GoogleServices-Info.plist: change xml<key>IS_ANALYTICS_ENABLED</key> to true
  4. Add reference to Firebase.h to Sources
  5. Configure Xcode (iOS) exporter:
    1. Shared:
      1. Extra Compiler Flags: -fno-aligned-allocation
      2. Extra Linker Flags: $(OTHER_LDFLAGS) -ObjC -lsqlite3 -lz
      3. Custom PList:
      <plist version="1.0">
          <dict>
              <key>NSAppTransportSecurity</key>
                  <dict>
                      <key>NSAllowsArbitraryLoads</key>
                          <true/>
                  </dict>
          </dict>
      </plist>
      1. Extra System Frameworks: CoreMotion, MediaPlayer, AdSupport, MessageUI, CoreServices, CoreTelephony, Security, StoreKit, SystemConfiguration, UIKit, Foundation, CoreMedia, GLKit
      2. Frameworkds Search Path: /Users/home/Documents/git_projects/Firebase/FirebaseAnalytics; /Users/home/Documents/git_projects/Firebase/FirebaseCrashlytics; /Users/home/Documents/git_projects/firebase_cpp_sdk/xcframeworks
      3. Extra Custom Frameworks:
/Users/home/Documents/git_projects/Firebase/FirebaseAnalytics/FBLPromises.xcframework
/Users/home/Documents/git_projects/Firebase/FirebaseAnalytics/FirebaseAnalytics.xcframework
/Users/home/Documents/git_projects/Firebase/FirebaseAnalytics/FirebaseCore.xcframework
/Users/home/Documents/git_projects/Firebase/FirebaseAnalytics/FirebaseCoreInternal.xcframework
/Users/home/Documents/git_projects/Firebase/FirebaseAnalytics/FirebaseInstallations.xcframework
/Users/home/Documents/git_projects/Firebase/FirebaseAnalytics/GoogleAppMeasurement.xcframework
/Users/home/Documents/git_projects/Firebase/FirebaseAnalytics/GoogleAppMeasurementIdentitySupport.xcframework
/Users/home/Documents/git_projects/Firebase/FirebaseAnalytics/GoogleUtilities.xcframework
/Users/home/Documents/git_projects/Firebase/FirebaseAnalytics/nanopb.xcframework
/Users/home/Documents/git_projects/Firebase/FirebaseCrashlytics/FirebaseCoreExtension.xcframework
/Users/home/Documents/git_projects/Firebase/FirebaseCrashlytics/FirebaseCrashlytics.xcframework
/Users/home/Documents/git_projects/Firebase/FirebaseCrashlytics/FirebaseSessions.xcframework
/Users/home/Documents/git_projects/Firebase/FirebaseCrashlytics/PromisesSwift.xcframework
/Users/home/Documents/git_projects/firebase_cpp_sdk/xcframeworks/firebase_analytics.xcframework
/Users/home/Documents/git_projects/firebase_cpp_sdk/xcframeworks/firebase.xcframework
/Users/home/Documents/git_projects/Firebase/FirebaseMessaging/FirebaseMessaging.xcframework
/Users/home/Documents/git_projects/Firebase/FirebaseMessaging/GoogleDataTransport.xcframework
  1. Debug/Release
    1. Header Search Paths: /Users/home/Documents/git_projects/Firebase/FirebaseAnalytics; /Users/home/Documents/git_projects/Firebase/FirebaseCrashlytics; /Users/home/Documents/git_projects/Firebase/FirebaseMessaging/FirebaseMessaging; /Users/home/Documents/git_projects/firebase_cpp_sdk/xcframeworks
    2. Extra Search Library Paths:
/Users/home/Documents/git_projects/Firebase/FirebaseAnalytics;
/Users/home/Documents/git_projects/Firebase/FirebaseMessaging;
/Users/home/Documents/git_projects/Firebase/FirebaseCrashlytics;
/Users/home/Documents/git_projects/firebase_cpp_sdk/xcframeworks
$(SDKROOT)/usr/lib/swift;
$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME);
$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME);
  4. Custom XCode Flags:
GCC_GENERATE_DEBUGGING_SYMBOLS=YES, 
GCC_DEBUGGING_SYMBOLS = full,  
DEBUG_INFORMATION_FORMAT=dwarf-with-dsym,  
DWARF_DSYM_FILE_NAME = "$(TARGET_NAME).dSYM",  
DWARF_DSYM_FOLDER_PATH = "$(CONFIGURATION_BUILD_DIR)/dSyms",
COPY_PHASE_STRIP=YES,
CONFIGURATION_BUILD_DIR="$(inherited)",

SWIFT_VERSION=5.0,
SWIFT_OPTIMIZATION_LEVEL="-Onone",
LD_VERIFY_BITCODE=NO,
LD_RUNPATH_SEARCH_PATHS=/usr/lib/swift,
ALWAYS_EMBED_SWIFT_STANDART_LIBRARIES=YES
  1. Export iOS project to XCode
  2. Under Project->Build Options->Debug Information Format change to DWARF with dSYM File (we will need these files to upload to Firebase for de-obfuscating crash reports)
  3. Build app and check Verify that app showed up in Analytics
/Users/home/Documents/git_projects/Firebase/FirebaseCrashlytics/upload-symbols -gsp /Users/home/JuceProjects/Pulsar-Projuser/Source/GoogleService-Info.plist -p ios "<path xcode archive>/dSyms/"

Few useful debug arguments for XCode Schemas (Arguments passed on Launch): -FIRAnalyticsDebugEnabled -FIRDebugEnabled

Links: Firebase C++ SDK Guide: https://firebase.google.com/docs/cpp/setup?platform=ios Firebase Setup without Cocaposds: https://firebase.google.com/docs/ios/setup

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published