📂
JackyChen的精神時光屋
  • About
  • iPlayground
    • iPlayground 2020
      • iPlayground submit 2020
    • iPlayground 2019
      • Untitled
      • iPlayground submit 2019
  • WWDC
    • 2020 WWDC
    • 2019 WWDC
    • 2018 WWDC
      • What's New in Testing
      • BusinessChat
    • 2016 WWDC
      • What's New in the Apple Push Notification Service
  • AR/VR
    • ARKit plugin at Unity
    • ARKit
    • AR/VR 實習作品分享
    • Google Blocks
  • CI/CD
    • Continous Integretion for Unity
    • 拯救地球大作戰-自動化設定注意事項
    • Provisioning Profile 自動化更新
    • Make ipa file with personal team of code sign
    • Xcode11 版號問題
  • Test
    • Cucumberish
    • XCUITest
    • Design Patterns in XCUITest
    • Unit Test
  • User Interface
    • IBDesignable 和 IBInspectable
    • iOS 使用貝塞爾曲線繪製路徑
    • UIStatusBarStyle
    • iOS Devices Specification
    • Vector Image
    • Launch Screen
    • Haptic Feedback
    • Good Works for Storyboard
    • Cell 展開收合效果
    • ScrollView
    • Swift lazy
    • Lottie
  • Foundation
    • Adding a Custom Font to Your App
    • WKWebView how to work with javascript
    • Global Central Dispatch
    • HealthKit
    • Error Handling
    • Debug with LLDB
    • Application Lifecycle
    • Swift Codable
    • Push Notifications
    • AVFoudation
  • Others
    • C語言指標概念
    • UnsafePointer(Swift)
    • iOS News Reference
    • Blender
    • Free Web Server
    • Firebase
    • Firebase migration
    • GraphQL
    • Ruby
    • zsh command line
    • visudo
  • Security
    • 課程:App資安規劃與實作
    • KeyChain
    • iOS反組譯程序
    • Arxan
  • Git
    • Git
    • xcodeproj 合併衝突
    • Pull Request
  • Machine Learning
    • CoreML
    • Vision
    • Turi Create
  • 待分類
    • ABI Stability and More
    • Mirror
    • Carthage
    • SwiftUI
    • MVVM
    • OpenSSL
    • USDZ Convert
    • Nexus repository and gitlfs
Powered by GitBook
On this page
  • Firebase 導入
  • Fastlane 設定 - Firebase App Distribution

Was this helpful?

  1. Others

Firebase migration

PreviousFirebaseNextGraphQL

Last updated 5 years ago

Was this helpful?

Firebase 導入

  • 在 Cartfile 加入

      binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseAnalyticsBinary.json"
  • 打開 terminal,在專案下執行

      Carthage update --platform iOS
  • 打開 Xcode 專案,依下列步驟設定

    • Build Phases

    • Link Binary With Libraries

    • 左下角 +

    • Add Other -> Add Files

    • 至 Carthage/Build/iOS,選取 Firebase 相關 Framework,點右下角 Open 加入

      PS:不要加進 Embed Frameworks,因為 Firebase 的 Framework 都是 Static Library
  • 至 Build Settings->Other Linker Flags 新增 -ObjC

    • 若遇到 Duplicate Symbole 問題(如難字 Library),則改用 -force_load 來新增,如下

      -force_load Carthage/Build/iOS/FIRAnalyticsConnector.framework/FIRAnalyticsConnector 
      -force_load Carthage/Build/iOS/FirebaseAnalytics.framework/FirebaseAnalytics 
      -force_load Carthage/Build/iOS/FirebaseCore.framework/FirebaseCore 
      -force_load Carthage/Build/iOS/FirebaseCoreDiagnostics.framework/FirebaseCoreDiagnostics 
      -force_load Carthage/Build/iOS/FirebaseInstanceID.framework/FirebaseInstanceID 
      -force_load Carthage/Build/iOS/GoogleAppMeasurement.framework/GoogleAppMeasurement 
      -force_load Carthage/Build/iOS/GoogleUtilities.framework/GoogleUtilities 
      -force_load Carthage/Build/iOS/GoogleDataTransport.framework/GoogleDataTransport 
      -force_load Carthage/Build/iOS/GoogleDataTransportCCTSupport.framework/GoogleDataTransportCCTSupport 
      -force_load Carthage/Build/iOS/nanopb.framework/nanopb
  • 至 Firebase 官網,下載 GoogleService-Info.plist,並將該檔案加入專案

    PS:Firebase 相關存取權限,請洽資規科
  • 打開 AppDelegate,加入以下程式碼

    • objective-c

        @import UIKit;
        @import Firebase;    // 加入此行
      
        @implementation AppDelegate
      
        - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
        {
          [FIRApp configure];    // 加入此行
          return YES;
        }
    • swift

        import UIKit
        import Firebase    // 加入此行
      
        @UIApplicationMain
        class AppDelegate: UIResponder, UIApplicationDelegate 
        {
          var window: UIWindow?
      
          func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool 
          {
            FirebaseApp.configure()    // 加入此行
            return true
          }
        }

Fastlane 設定 - Firebase App Distribution

    • Gemfile(放在專案下)

    • Gemfile.lock(放在專案下)

    • Pluginfile(放在專案 fastlane 資料夾下)

  • 參考下列代碼,在註解的地方進行修改 Fastfile

desc "Firebase App_distribution"
lane :beta do |values|

  env=values[:env]
  notes = values[:notes] ? values[:notes] : 'It is '+env+' environment'

  build_ios_app(scheme: 'CathayLifeAppStore.'+env,    // 請改成各自專案的 scheme 名稱
                export_options: {
                  method: "enterprise",
                  provisioningProfiles: provisioningProfiles
                }
  )

  firebase_app_distribution(
      app: "1:8156708xxxxx:ios:9ef3c94020c178627xxxxx",  // 請參照 GoogleService-Info.plist 的 GOOGLE_APP_ID
      groups: "cathayappstore-ios",        // 請在 Firebase 自訂測試群組名稱
      release_notes: notes,
      firebase_cli_path: "/usr/local/bin/firebase",
      firebase_cli_token: ENV["FIREBASE_TOKEN"]
  )

  upload_symbols_to_crashlytics(api_token: '210cae29d9313bf20a7895e227a817eb0d9bac8d')

end
  • 將以上修改 push 上 Git,並進行發布以測試是否正常運作

  • 收到邀請信後,會打開一個下載測試版的連結,可參考以下步驟在桌面建立捷徑,方便下次使用

,解壓縮後取得三個檔案

點我下載