ios – How to store api-keys for AppDelegate.swift securely


import UIKit
import Flutter
import GoogleMaps
import flutter_local_notifications

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    // Todo: Add your API key here
    GMSServices.provideAPIKey("XXXXXXXXXXXXXXXX")

    FlutterLocalNotificationsPlugin.setPluginRegistrantCallback { (registry) in
        GeneratedPluginRegistrant.register(with: registry)
    }

    if #available(iOS 10.0, *) {
      UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate
    }
    
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

I am making a flutter mobile app and above is my ios/Runner/AppDelegate.swift file.
Now i need to provide it Gmap api key but from another file which would be .gitignored so my api-keys arent published on my Version Control.

I have done something simmilar on Android by storing keys under:
android/app/src/main/res/values/keys.xml

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img