문의 시, 사용하시는 SDK 버전 정보와 디벨로퍼스 앱ID를 알려주세요.
KMSDK] Version : 2.10.5-b4
SwiftUI로 맵 생성하고 있는데, 인증은 성공했다고 나오는데 화면이 연두색으로만 나옵니다…
혹시 원인을 알 수 있을까요?
ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ
[I][KMSDK] [MTLMapContainer(252f7d0)] initializeView
[I][KMSDK] [MTLMapContainer(252f7d0)] Not first run.
[I][KMSDK] ASSET ROOT PATH: /Users/haesik/Library/Developer/CoreSimulator/Devices/9321F071-40B5-485D-8925-A3D264AC5450/data/Containers/Bundle/Application/3F1E1A41-8FD2-4D17-A678-B3747827E6A2/MatJang.app/KakaoMapsSDK-SPM_KakaoMapsSDK-SPM.bundle/assets/
[I][KMSDK] ASSET ROOT PATH:
[I][KMSDK] Version : 2.10.5-b4
[I][K3fCore] app diplay scale: 1.500000
[I][KMSDK] ASSET ROOT PATH: /Users/haesik/Library/Developer/CoreSimulator/Devices/9321F071-40B5-485D-8925-A3D264AC5450/data/Containers/Bundle/Application/3F1E1A41-8FD2-4D17-A678-B3747827E6A2/MatJang.app/KakaoMapsSDK-SPM_KakaoMapsSDK-SPM.bundle/assets/
[I][DiskCache] DiskCache instance count : 1
[I][DiskCache] DB multithreading mode set to SQLITE_CONFIG_SINGLETHREAD
[I][DiskCache] DiskCache check init state…
[I][DiskCache] Dao initialize…
[I][DiskCache] DiskCache db(/Users/haesik/Library/Developer/CoreSimulator/Devices/9321F071-40B5-485D-8925-A3D264AC5450/data/Containers/Data/Application/7C99AAD5-6BD6-479B-9CF1-6BBF083A08BF/Library/Caches/vectormap/cache/db/cache.db) opened.
[I][DiskCache] Buffer initialize lock waiting : 0
[I][DiskCache] Buffer initialize elapsed time : 0, buffer size : 0
[I][DiskCache] DiskCache initialized
[I][K3fCore] DownloadManager initialized
[I][K3fCore] >>> Initialize appEngine[RELEASE]{1721626235}
Optional(“RenderMode : Metal\nDeviceInfo\nDeviceName : iPhone Simulator\nDeviceVersion : 0.0\nOSType : 1\nOSVersion : os:17.5.0\nSDKVersion : 2.10.5-b4\nDocumentPath : /Users/haesik/Library/Developer/CoreSimulator/Devices/9321F071-40B5-485D-8925-A3D264AC5450/data/Containers/Data/Application/7C99AAD5-6BD6-479B-9CF1-6BBF083A08BF/Documents\nViewSize : 3, 3\ndensity : 3, ppi : 200\nAppName : sik.MatJang\n========================\nRenderView Infos\n========================\nEngine state : stopped\n”)
fuction call
[I][K3fCore] >>> Start appEngine[RELEASE]{1721626235}
[I][KMSDK] [MTLMapContainer(6fac2ab8)] StartEngine
[I][Auth] Auth result Received
[I][Auth] Authentication OK!!
[I][K3fCore] Engine{1721626235} stopped.
[I][KMSDK] [MTLMapContainer(6fac2b98)] StopEngine
[I][KMSDK] [MTLMapContainer(252f7d0)] layoutSubviews
[I][KMSDK] [MTLMapContainer(252f7d0)] layoutSubviews
성공
ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ
MatJangApp.swift
import SwiftUI
import KakaoSDKAuth
import KakaoSDKCommon
import KakaoMapsSDK
@main
struct MatJangApp: App {
let kakaoNativeAppKey = Bundle.main.infoDictionary?[“KAKAO_NATIVE_APP_KEY”] as? String ?? “”
init(){
KakaoSDK.initSDK(appKey: kakaoNativeAppKey)
SDKInitializer.InitSDK(appKey: kakaoNativeAppKey)
}
var body: some Scene {
WindowGroup {
MainMap()
}
}
MainMap.swift
import SwiftUI
import KakaoMapsSDK
struct MainMap: View {
@State var draw: Bool = false
var body: some View {
KakaoMapView(draw: $draw).onAppear(perform: {
self.draw = true
}).onDisappear(perform: {
self.draw = false
}).frame(maxWidth: .infinity, maxHeight: .infinity)
}
}
struct KakaoMapView: UIViewRepresentable{
@Binding var draw: Bool
func makeUIView(context: Self.Context) -> KMViewContainer {
let view: KMViewContainer = KMViewContainer()
view.sizeToFit()
context.coordinator.createController(view)
context.coordinator.controller?.prepareEngine()
return view
}
func updateUIView(_ uiView: KMViewContainer, context: Self.Context) {
if draw {
context.coordinator.controller?.activateEngine()
}
else {
context.coordinator.controller?.resetEngine()
}
}
func makeCoordinator() -> KakaoMapCoordinator {
return KakaoMapCoordinator()
}
static func dismantleUIView(_ uiView: KMViewContainer, coordinator: KakaoMapCoordinator) {
}
class KakaoMapCoordinator: NSObject, MapControllerDelegate{
override init(){
first = true
super.init()
}
func authenticationSucceeded() {
print("성공")
}
func createController(_ view: KMViewContainer) {
controller = KMController(viewContainer: view)
controller?.delegate = self
print(controller?.getStateDescMessage())
print("fuction call")
}
func addViews() {
let defaultPosition: MapPoint = MapPoint(longitude: 14135167.020272, latitude: 4518393.389136)
let mapviewInfo: MapviewInfo = MapviewInfo(viewName: "mapview", viewInfoName: "map", defaultPosition: defaultPosition)
controller?.addView(mapviewInfo)
}
func addViewSucceeded(_ viewName: String, viewInfoName: String) {
print("OK") //추가 성공. 성공시 추가적으로 수행할 작업을 진행한다.
}
//addView 실패 이벤트 delegate. 실패에 대한 오류 처리를 진행한다.
func addViewFailed(_ viewName: String, viewInfoName: String) {
print("Failed")
}
/// KMViewContainer 리사이징 될 때 호출.
func containerDidResized(_ size: CGSize) {
let mapView: KakaoMap? = controller?.getView("mapview") as? KakaoMap
mapView?.viewRect = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: size)
if first {
let cameraUpdate: CameraUpdate = CameraUpdate.make(target: MapPoint(longitude: 14135167.020272, latitude: 4518393.389136), zoomLevel: 10, mapView: mapView!)
mapView?.moveCamera(cameraUpdate)
first = false
}
}
var controller: KMController?
var first: Bool
}
}