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 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,13 +1,29 @@
|
||||
import Flutter
|
||||
import UIKit
|
||||
import YandexMapsMobile
|
||||
|
||||
@main
|
||||
@objc class AppDelegate: FlutterAppDelegate {
|
||||
@objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate {
|
||||
override func application(
|
||||
_ application: UIApplication,
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||
) -> Bool {
|
||||
GeneratedPluginRegistrant.register(with: self)
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user