Files
be_happy_public/ios/Runner/AppDelegate.swift
Alexander Shidlovsky 9fa2fcfc63 fix(ios): запуск на iOS — MapKit, ключ из xcconfig, CocoaPods
- AppDelegate: YMKMapKit до super, регистрация плагинов по шаблону Flutter 3.41
- Info.plist: YandexMapKitApiKey из $(YANDEX_MAPKIT_API_KEY)
- Debug/Release/Profile.xcconfig: ключ, include Pods и опциональный Secrets
- Podfile, workspace, pbxproj; .gitignore для Secrets.xcconfig, пример Secrets
- ios/README.md
2026-05-14 10:18:07 +03:00

30 lines
1.1 KiB
Swift

import Flutter
import UIKit
import YandexMapsMobile
@main
@objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
let apiKey =
(Bundle.main.object(forInfoDictionaryKey: "YandexMapKitApiKey") as? String ?? "")
.trimmingCharacters(in: .whitespacesAndNewlines)
#if DEBUG
if apiKey.isEmpty || apiKey.contains("$(") {
assertionFailure(
"YandexMapKitApiKey пустой или не подставился из xcconfig — проверь YANDEX_MAPKIT_API_KEY в ios/Flutter/*.xcconfig"
)
}
#endif
YMKMapKit.setLocale(Locale.current.identifier)
YMKMapKit.setApiKey(apiKey)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) {
GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry)
}
}