안녕하세요. iOS 에서 Route 를 생성 하는데요. 없는 객체 접근 시도 하여 오류가 발생하고 있습니다.
간헐적으로 발생되는 부분인데 오류 확인이 가능할까 싶어서요.
맵은 이미 init 이 완료된 상태에서 addRoute 를 요청하는 상태입니다. 관련 크래시 로그 첨부 드리오니 확인 요청 드립니다.
crash_kakao.txt (68.3 KB)
안녕하세요. iOS 에서 Route 를 생성 하는데요. 없는 객체 접근 시도 하여 오류가 발생하고 있습니다.
간헐적으로 발생되는 부분인데 오류 확인이 가능할까 싶어서요.
맵은 이미 init 이 완료된 상태에서 addRoute 를 요청하는 상태입니다. 관련 크래시 로그 첨부 드리오니 확인 요청 드립니다.
crash_kakao.txt (68.3 KB)
마커와 컬러값 카운트까지 똑같은 부분과
각 segement 안에 2개이상의 포인트, 각 포인트가 다른부분, 한 segemnt 끝 point 와 다음 segement 시작 point 가 동일한 부분까지도 확인 했습니다.
@vectordev
이 내용 한번 체크해주실 수 있을까요
안녕하세요.
우선 원인은 기존 Route를 삭제하고 재생성 할때 RouteLayer는 유지한 상태로 route 를 삭제하고 재생성 해야 하는데
RouteLayer 를 삭제하고 RouteLayer와 route를 다시 그려주는 작업을 반복하다 보니 이슈가 발생 되었습니다.
routeLayer 에 route 를 삭제하는걸로 코드를 변경하니 죽지는 않는데
addRouteLayer 를 하자마자 addRouteStyleSet 와 addRoute 를 진행하면 크래시가 발생되는것 같습니다.
크래시 로그가 있으시면 올려주시면 확인이 용이할 것 같습니다.
let layer = manager?.addRouteLayer(layerID: "simpleRoute", zOrder: 0)
// Style....
let styleSet = RouteStyleSet(styleID: "simpleRouteStyle")
let colors = ["0x3396ffff", "0x20c435ff", "0xffb200ff", "0xffb200ff"]
for index in 0 ..< colors.count {
let levelStyle = RouteStyle(styles: [
PerLevelRouteStyle(width: 18, color: UIColor(hex: colors[index])!, strokeWidth: 0, strokeColor: UIColor(hex: "0xffffffff")!, level: 0, patternIndex: -1)
])
styleSet.addStyle(levelStyle)
}
manager?.addRouteStyleSet(styleSet)
// pattern 추가해서 하나 더 넣음
let patterned = RouteStyleSet(styleID: "simpleRoutePatterned")
patterned.addPattern(RoutePattern(pattern: UIImage(contentsOfFile: _frameworkBundle.bundlePath + "/assets/dev/example/routes/route_pattern_arrow.png")!, distance: 60, symbol: nil, pinStart: false, pinEnd: false))
for index in 0 ..< colors.count {
let levelStyle = RouteStyle(styles: [
PerLevelRouteStyle(width: 18, color: UIColor(hex: colors[index])!, strokeWidth: 0, strokeColor: UIColor(hex: "0xffffffff")!, level: 0, patternIndex: 0)
])
patterned.addStyle(levelStyle)
}
manager?.addRouteStyleSet(patterned)
// Route 생성
let coord = MapPoint(longitude: 127.038575, latitude: 37.499699).wgsCoord
let seg1 = RouteSegment(points: [
MapPoint(longitude: coord.longitude, latitude: coord.latitude),
MapPoint(longitude: coord.longitude + 0.0008, latitude: coord.latitude),
MapPoint(longitude: coord.longitude + 0.0008, latitude: coord.latitude + 0.0008),
MapPoint(longitude: coord.longitude + 0.0016, latitude: coord.latitude + 0.0008)], styleIndex: 0)
let seg2 = RouteSegment(points: [
MapPoint(longitude: coord.longitude + 0.0016, latitude: coord.latitude + 0.0008),
MapPoint(longitude: coord.longitude + 0.0016, latitude: coord.latitude + 0.0032),
MapPoint(longitude: coord.longitude + 0.0032, latitude: coord.latitude + 0.0032)], styleIndex: 1)
var curvePoints = Primitives.getCurvePoints(startPoint: MapPoint(longitude: coord.longitude + 0.0032, latitude: coord.latitude + 0.0032),
endPoint: MapPoint(longitude: coord.longitude + 0.0064, latitude: coord.latitude + 0.0064),
isLeft: true)
let seg3 = RouteSegment(points: curvePoints, styleIndex: 2)
/*
let seg3 = RouteSegment(points: [
MapPoint(longitude: coord.longitude + 0.0032, latitude: coord.latitude + 0.0032),
MapPoint(longitude: coord.longitude + 0.0064, latitude: coord.latitude + 0.0048),
MapPoint(longitude: coord.longitude + 0.0064, latitude: coord.latitude + 0.0056),
MapPoint(longitude: coord.longitude + 0.0064, latitude: coord.latitude + 0.0064)], styleIndex: 2)
*/
let option = RouteOptions(routeID: "simple_1", styleID: "simpleRoutePatterned", zOrder: 0)
option.segments = [seg1, seg2, seg3]
let route = layer?.addRoute(option: option)
보통은 이런식으로 연속적으로 호출해도 문제가 발생하지 않습니다.