简体   繁体   English

这里 iOS 高级地图 - setAppId 崩溃

[英]HERE iOS Premium Map - setAppId Crash

I have an odd crash that is happening to a minority of our users, but frequently enough to be a concern.我有一个奇怪的崩溃发生在我们的少数用户身上,但频率足以引起关注。

if(!NMAApplicationContext.isInitialized()) {
  NMAApplicationContext.setAppId(HERE_MAP_APP_ID, appCode: HERE_MAP_APP_CODE, licenseKey: HERE_MAP_LICENSE_KEY)
}

Any ideas what might cause this init call to fail?任何可能导致此 init 调用失败的想法?

Thanks!谢谢!

Additional Info:附加信息:

From our crashlytics report,根据我们的 crashlytics 报告, 发生崩溃的设备

在此处输入图片说明

Please let me know if you need additional info.如果您需要其他信息,请告诉我。 Thanks!谢谢! Update - I was able to capture the crash in XCode.更新 - 我能够在 XCode 中捕获崩溃。 Stacktrace:堆栈跟踪:

frame #0: 0x00000001bd4520dc libsystem_kernel.dylib`__pthread_kill + 8
frame #1: 0x00000001bd4cb094 libsystem_pthread.dylib`pthread_kill$VARIANT$mp + 380
frame #2: 0x00000001bd3abea8 libsystem_c.dylib`abort + 140
frame #3: 0x0000000104724f60 NMAKit`___lldb_unnamed_symbol2248$$NMAKit + 476

I was able to repro it.我能够重现它。 The code is above is called on foregrounding, and it appears that the isInitialized call is returning false on a foregrounding (not a fresh app start), so it is trying to reInit the library....and then it crashes.上面的代码是在前台调用的,看来 isInitialized 调用在前台(不是新的应用程序启动)上返回 false,所以它试图重新初始化库......然后它崩溃了。 Hope that helps.希望有帮助。

Your code :你的代码:

if(!NMAApplicationContext.isInitialized()) {
  NMAApplicationContext.setAppId(HERE_MAP_APP_ID, appCode: HERE_MAP_APP_CODE, licenseKey: HERE_MAP_LICENSE_KEY)
}

Causes crash because it has incorrect API usage:导致崩溃,因为它的 API 使用不正确:

  1. Set credentials should be set before ANY HereSDK API call was used.应在使用任何 HereSDK API 调用之前设置凭据。
  2. The NMAApplicationContext doesn't provide the authorize verification methods, the NMAApplicationContext.isInitialized() checks whether map functionality is ready to use (whether engine already started). NMAApplicationContext不提供授权验证方法,NMAApplicationContext.isInitialized() 检查地图功能是否可以使用(引擎是否已经启动)。 The NMAApplicationContext.isInitialized() is checked before custom configuration setup .自定义配置设置之前检查 NMAApplicationContext.isInitialized()。

How to solve crash:如何解决崩溃:

  1. Remove the NMAApplicationContext.isInitialized() if statement删除 NMAApplicationContext.isInitialized() if 语句
  2. Call the NMAApplicationContext.setAppId(HERE_MAP_APP_ID, appCode: HERE_MAP_APP_CODE, licenseKey: HERE_MAP_LICENSE_KEY) method and check the NMAApplicationContextError return value whether setup of credential was successful.调用 NMAApplicationContext.setAppId(HERE_MAP_APP_ID, appCode: HERE_MAP_APP_CODE, licenseKey: HERE_MAP_LICENSE_KEY) 方法并检查 NMAApplicationContextError 返回值是否设置凭据成功。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM