Skip to content

Instantly share code, notes, and snippets.

@ampersanda
Last active April 22, 2020 07:29
Show Gist options
  • Save ampersanda/05e0e572a08ea39ff1d5bea19ae66b9c to your computer and use it in GitHub Desktop.
Save ampersanda/05e0e572a08ea39ff1d5bea19ae66b9c to your computer and use it in GitHub Desktop.
Flutter Release configuraton for ios
import UIKit
import Flutter
import GoogleMaps
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
// Add GoogleMapsAPIKey to reference MAPS_API_KEY in Info.plist
GMSServices.provideAPIKey(infoForKey("GoogleMapsAPIKey")!)
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
func infoForKey(_ key: String) -> String? {
return (Bundle.main.infoDictionary?[key] as? String)
}
}
// ios/Flutter
APP_NAME = Debug App Name
#include "DebugMaps.xcconfig"
FLUTTER_TARGET_BUILD_MAIN = ${FLUTTER_APPLICATION_PATH}/lib/main_staging.dart
PRODUCT_BUNDLE_IDENTIFIER_BUILD = com.example.staging
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
// This file is inside root project
// This file is inside root project
// ios/Flutter
APP_NAME = Release App Name
#include "ReleaseMaps.xcconfig"
FLUTTER_TARGET_BUILD_MAIN = ${FLUTTER_APPLICATION_PATH}/lib/main_production.dart
PRODUCT_BUNDLE_IDENTIFIER_BUILD = com.example
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
#!/bin/bash
# Copy and rename correspond GoogleService-Info.plist to real path
cp GoogleService-Info-production.plist GoogleService-Info.plist
mv GoogleService-Info.plist ios/Runner/GoogleService-Info.plist
#!/bin/bash
# Copy and rename correspond GoogleService-Info.plist to real path
cp GoogleService-Info-staging.plist GoogleService-Info.plist
mv GoogleService-Info.plist ios/Runner/GoogleService-Info.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment