尝试在此处为iOS探索创建MAPIMAGE实例,以给出一个奇怪的错误
init(coordinates: GeoCoordinates, image: UIImage) {
let pngData = image.pngData()
let mapImage = MapImage(pixelData: pngData!, imageFormat: ImageFormat.png)
print("i did print")
self.mapMarker = MapMarker(at: coordinates, image: mapImage)
}
这是错误消息 -
dyld4 config:dyld_library_path =/usr/lib/lib/system/Intropcection dyld_insert_libraries =/开发人员/usr/lib/libbacktraceRecording.dylib:/developer/usr/lib/libmainthreadchecker.dylib:/develops devpricenter/developer/library/library/privateframeworks/dtddisupport.frame.frame.frame.framewib yllib.dylib.dyllcort.dydyllcougport.dydyllcougport.dydyllcougport.dyllcougportsuersuuse 终止以未知类型std :: runtime_error:SDK终止 发动机为无效。请提供一个有效的对象。
当调用mapImage构造函数时,PNGDATA并不是一个零值,我通过打印对其进行了检查。这个错误是什么意思,我该如何修复?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我自己想了。该问题的症结在于,在创建MapImage实例之前,需要初始化Heresdk引擎,可以通过两种方式来进行
初始化MapView,而MapView又可以初始化Heresdk Engine,但在我的情况下,此初始化是在此之后发生的。 mapimage实例初始化语句。
在mapimage实例初始化语句。
之前明确初始化引擎。
做{
尝试sdkinitializer.initializeifnequestares()
} 抓住 {
fatalerror(“在此处无法初始化SDK。原因:(错误)”)
}
这也可以在AppDelegate文件中完成。
I figured this out myself. The crux of the issue is that before creating the MapImage instance the HereSDK engine needs to be initialized which can be done in 2 ways-
Initialize the MapView which in turn initializes the HereSDK engine but in my case this initialization was happening after the MapImage instance initialization statement.
Initialize the engine explicitly before the MapImage instance initialization statement.
do {
try SDKInitializer.initializeIfNecessary()
} catch {
fatalError("Failed to initialize HERE SDK. Cause: (error)")
}
This can be done in the AppDelegate file as well.