yandex / mapkit-ios-demo

MapKit iOS demo
Other
82 stars 25 forks source link

При установке API ключа вызывает UI Thread из background #44

Closed thisisdingo closed 5 years ago

thisisdingo commented 5 years ago

2019-07-22 15:33:08.047418+0300 ------------[2308:409664] yandex::maps::runtime::config::internal::ConfigManagerImpl::ConfigManagerImpl <warn>: Custom experiments are not allowed ================================================================= Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState] PID: 2308, TID: 409661, Thread name: 1#BgNorm(Global, Queue name: com.apple.root.default-qos.overcommit, QoS: 0 Backtrace: 2019-07-22 15:33:08.053039+0300 Vodovoz[2308:409661] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState] PID: 2308, TID: 409661, Thread name: 1#BgNorm(Global, Queue name: com.apple.root.default-qos.overcommit, QoS: 0 Backtrace:

thisisdingo commented 5 years ago

Swift 5.0 Xcode: 10.2.1 Deployment target: 9.0

thisisdingo commented 5 years ago

Duplicating https://github.com/yandex/mapkit-ios-demo/issues/30

EmmaVvv commented 5 years ago

Did you solve this issue?

thisisdingo commented 5 years ago

@EmmaVvv Not yet. But if something is, I'll let you know)

thisisdingo commented 5 years ago

@EmmaVvv I called the method YMKMapKit.setApiKey(Constants.ApiKeys.yandexMaps) from the view controller in viewHasAppeared.

override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)
    YMKMapKit.setApiKey(Constants.ApiKeys.yandexMaps)
}

Вроде щас все работает

EmmaVvv commented 5 years ago

Крашится теперь( Эту проблему они должны решить, но почему-то она их не волнует Не знаю что теперь делать. На другую карту не могу поменять.. Клиент хочет именно Яндекс

thisisdingo commented 5 years ago

@EmmaVvv А что пишет?

EmmaVvv commented 5 years ago

Ну классика жанра.. что надо API key заранее задавать

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'You need to set API key before using MapKit.'

EmmaVvv commented 5 years ago

То есть я правильно поняла, ты в апп делегате НЕ вызываешь уже метод

YMKMapKit.setApiKey

а делаешь это только во вью контроллере, который отображает карту?

thisisdingo commented 5 years ago

@EmmaVvv да. Вызываю его в первом открывшемся вью контроллере. Благо у меня экран карты находится далеко.

EmmaVvv commented 5 years ago

Ааа, вот почему не крашится) Нет, у меня он первый) Но спасибо в любом случае

georrge1994 commented 4 years ago

таккая же проблема на andoird..

e60wep commented 4 years ago

Решил проблему добавлением в AppDelegate

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { YMKMapKit.setApiKey("myKey") return true }

pabrr commented 3 years ago

Есть ещё решение в issue https://github.com/yandex/mapkit-ios-demo/issues/37 для проблем с многомодульностью