ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • M1๋งฅ๋ถ ์นด์นด์˜ค ๋งต ๊ตฌํ˜„ ๋ฐฉ๋ฒ• ( kakao SDK for ios )
    iOS 2022. 6. 18. 02:35

    ํ˜„์žฌ ์ €์˜ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์€ M1 ๋งฅ๋ถ, Xcode: 13.4.1 , Simulator: ios 15.5์ž…๋‹ˆ๋‹ค.

    ์นด์นด์˜คํ†ก ๋””๋ฒจ๋กœํผ ๊ฐ€์ด๋“œ์™€ ๊ฒ€์ƒ‰์„ ํ†ตํ•ด ์ง„ํ–‰ํ–ˆ์œผ๋ฉฐ ์—ฌ๋Ÿฌ ๊ฐ€์ง€ ๋ฌธ์ œ๋กœ ์ธํ•˜์—ฌ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. 

     

    ๋„ค์ดํ‹ฐ๋ธŒ ์•ฑ ํ‚ค ๋ฐœ๊ธ‰ ๋ฐ Bundle ID ๋“ฑ๋กํ•˜๊ธฐ ์œ„ํ•˜์—ฌ

    1. ์นด์นด์˜ค ๊ฐœ๋ฐœ์ž ์‚ฌ์ดํŠธ์— ์ ‘์†ํ•ฉ๋‹ˆ๋‹ค. 

    https://developers.kakao.com/product/map

     

    Kakao Developers

    ์นด์นด์˜ค API๋ฅผ ํ™œ์šฉํ•˜์—ฌ ๋‹ค์–‘ํ•œ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๊ฐœ๋ฐœํ•ด๋ณด์„ธ์š”. ์นด์นด์˜ค ๋กœ๊ทธ์ธ, ๋ฉ”์‹œ์ง€ ๋ณด๋‚ด๊ธฐ, ์นœ๊ตฌ API, ์ธ๊ณต์ง€๋Šฅ API ๋“ฑ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

    developers.kakao.com

     

    2. API ์‚ฌ์šฉํ•˜๊ธฐ - ์‹œ์ž‘ํ•˜๊ธฐ์— ๋“ค์–ด๊ฐ‘๋‹ˆ๋‹ค.

     

    3. ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

     

    4. ์›ํ•˜๋Š” ์ด๋ฆ„๋ช…์œผ๋กœ ์•ฑ ์ด๋ฆ„, ์‚ฌ์—…์ž๋ช… ์ž‘์„ฑ ํ›„ ์ €์žฅํ•˜์—ฌ ๋งŒ๋“ค๊ธฐ

     

    5. ์™ผ์ชฝ ์•ฑ ์„ค์ • ๋ฉ”๋‰ด์— -> ํ”Œ๋žซํผ -> iosํ”Œ๋žซํผ ๋“ฑ๋ก

    ์œ„์— ์‚ฌ์ง„์— ๋ณด์ด๋Š” ๋นจ๊ฐ• ๋ฐ•์Šค์— ํ˜„์žฌ ์นด์นด์˜ค ๋งต์„ ๊ตฌํ˜„ํ•  xcode ํ”„๋กœ์ ํŠธ์˜ Bundle Identifier๊ฐ’์„ ๊ทธ๋Œ€๋กœ ์ ์–ด์ฃผ์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค.

    ๋”๋ณด๊ธฐ

    Bundle Identifier๊ฐ’์€ ํ”„๋กœ์ ํŠธ TARGETS -> General -> Identity -> Bundle Identifier์—์„œ ํ™•์ธํ•ด์ฃผ์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค.

     

     

    6. Info.plist ํŒŒ์ผ์— ๋ฐœ๊ธ‰๋ฐ›์€ App key๋ฅผ ๋„ฃ์–ด์ค๋‹ˆ๋‹ค.

    ์™ผ์ชฝ ์•ฑ ์„ค์ • ๋ฉ”๋‰ด์— -> ์š”์•ฝ์ •๋ณด -> ์•ฑ ํ‚ค -> ๋„ค์ดํ‹ฐ๋ธŒ ์•ฑ ํ‚ค๋ฅผ ๋ณต์‚ฌํ•ฉ๋‹ˆ๋‹ค.

    ์•„๋ž˜ ์‚ฌ์ง„๊ณผ ๊ฐ™์ด Info.plist์— KAKAO_APP_KEY

     

    7. ํ”„๋ ˆ์ž„์›Œํฌ๋“ค์„ ์ถ”๊ฐ€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

    ํ”„๋กœ์ ํŠธ - TARGETS - General - Frameworks, Libraries and Embedded Content๋กœ ์ด๋™ํ•˜์—ฌ

    + ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ ํ•„์š”ํ•œ ํ”„๋ ˆ์ž„ ์›Œํฌ๋“ค์„ ์ถ”๊ฐ€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

    • Metal.framework ( OpenGLES.framework ๋Œ€์‹  )
    • SystemConfiguration.framework
    • CoreLocation.framework
    • QuartzCore.framework
    • libc++.tbd
    • libxml2.tbd
    • libsqlite3.tbd

    โ€ป libc++.tbd / libxml2.tbd / libsqlite3.tbd ์„ธ ๊ฐ€์ง€๋Š” ํ•œ ๋ฒˆ์— ๋“ค์–ด๊ฐ€์ง€ ์•Š์•„ ๋‘ ๋ฒˆ ๋„ฃ์–ด ์ฃผ๋Š” ์ž‘์—…์„ ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

     

    โ€ปOpenGLES.framework๋Œ€์‹  Metal.framework๊ฐ€ ์“ฐ์ด๋Š” ์ด์œ 

    ๋”๋ณด๊ธฐ

    OpenGLES.framework๋Œ€์‹  Metal.framework๊ฐ€ ์“ฐ์ด๋Š” ์ด์œ  ๊ด€๋ จํ•ด์„œ ํ•œ ๋ฒˆ์ฏค ์ฝ๊ธฐ ์ข‹์€ ๋ธ”๋กœ๊ทธ์ธ ๊ฑฐ ๊ฐ™์Šต๋‹ˆ๋‹ค.

    2018๋…„๋„์— OpenGLES๋Š” ios์™€ MacOs์—์„œ ๋” ์ด์ƒ ์‚ฌ์šฉ๋˜์ง€ ์•Š๋„๋ก ๋ณ€๊ฒฝ๋˜์—ˆ์œผ๋ฉฐ Metal์€ Apple์— ์˜ํ•ด 2014๋…„๋„์— ๋“ฑ์žฅํ•˜์—ฌ OpenGLES ๋Œ€์‹  ์ข‹์€ ๋Œ€์•ˆ์ด ๋˜์—ˆ๋‹ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค. 

    https://levenshtein.tistory.com/382

     

    8. Kakao map SDK ๋‹ค์šด์„ ๋ฐ›์•„์•ผ ํ•ฉ๋‹ˆ๋‹ค.

    https://apis.map.kakao.com/ios/guide/

    ์œ„์— ๋งํฌ์— ๋“ค์–ด๊ฐ€ ๋‹ค์šด๋กœ๋“œ๋ฅผ ํ•ฉ๋‹ˆ๋‹ค.

    ๋‹ค์šด๋กœ๋“œํ•œ SDKํŒŒ์ผ์„ ์••์ถ•์„ ํ’€์–ด ์ค€ ํ›„ DaumMap.embeddedframework ํด๋”๋ฅผ 

    ํ”„๋กœ์ ํŠธ ์•ˆ์— ์žˆ๋Š” ํ”„๋ ˆ์ž„์›Œํฌ ํด๋”  ์•„๋ž˜์— ๋„ฃ์–ด์ฃผ์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค.

    ํ”„๋ ˆ์ž„์›Œํฌ ํด๋” ์šฐํด๋ฆญ ํ›„ Add Files to "~~" ํด๋ฆญํ•˜์—ฌ ๋ฐฉ๊ธˆ ์••์ถ• ํ‘ผ DaumMap.embeddedframeworkํด๋” ํŒŒ์ผ์„ ๋„ฃ์–ด์ค๋‹ˆ๋‹ค.

    ํด๋”๋ฅผ ๋„ฃ์–ด์ค€ ํ›„ ํ”„๋กœ์ ํŠธ - TARGETS - General - Frameworks, Libraries and Embedded Content๋กœ ์ด๋™ํ•˜์—ฌ

    DaumMap.framework๊ฐ€ ๋“ค์–ด๊ฐ€์ง„ ๊ฒƒ์„ ํ™•์ธํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

     

    9. ํ—ค๋” ํŒŒ์ผ์„ ๋งŒ๋“ค์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

    ์นด์นด์˜ค ๋งต์ด Objective-C๋กœ ์ž‘์„ฑ๋˜์–ด Swift์—์„œ ์‚ฌ์šฉํ•˜๋ ค๋ฉด ํ—ค๋” ํŒŒ์ผ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

    command + n ๋ˆŒ๋Ÿฌ ํ—ค๋” ํŒŒ์ผ์„ ๋งŒ๋“ค์–ด ์ค๋‹ˆ๋‹ค. ์ด๋ฆ„์€ ์›ํ•˜์‹œ๋Š” ์ด๋ฆ„ ์ ์–ด์ฃผ์…”๋„ ๋ฉ๋‹ˆ๋‹ค.

    ๋งŒ๋“  ํ—ค๋” ํŒŒ์ผ์—  #import <DaumMap/MtMapView.h>  ์ถ”๊ฐ€ํ•ด์ฃผ์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค.

    ํ—ค๋”ํŒŒ์ผ์„ ์—ฐ๊ฒฐํ•ด์ฃผ๊ธฐ ์œ„ํ•ด ์„ค์ •์„ ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

    TARGETS - Build Settings - ์™ผ์ชฝ ๊ฒ€์ƒ‰ ์นธ์— swift compiler ๊ฒ€์ƒ‰ ํ›„ Swift Compiler - General - Objective -C Bridging Header

    ํ”„๋กœ์ ํŠธ/ํ—ค๋” ํŒŒ์ผ๋ช…. h ๋กœ ์จ์ฃผ์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค.  ( ํ—ค๋” ํŒŒ์ผ full path ๊ฐ’ ๋„ฃ์–ด์ฃผ์…”๋„ ๋ฉ๋‹ˆ๋‹ค )

     

    10. Build Settings ์„ค์ •ํ•ด์ฃผ๊ธฐ

    ํ˜„์žฌ Map์šฉ SDK๋Š” Automatic Reference Counting(ARC)์„ ์ง€์›ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

    Objective-C Automatic Reference Counting - NO๋กœ ๋ฐ”๊ฟ”์ค€๋‹ค.

    Weak Reference in Manual Retain Release - NO๋กœ ๋ฐ”๊ฟ”์ค€๋‹ค.

    ๋”๋ณด๊ธฐ

    โ€ป ์—ฌ๋Ÿฌ ๋ฒˆ์˜ ์‚ฝ์งˆ๊ณผ ๊ฒฝํ—˜์œผ๋กœ ์–ป์€ ๊ฒฐ๊ณผ๋Š” ์ด์œ ๋Š” ์žˆ์ง€๋งŒ YES๋กœ ํ•ด๋„ ๋นŒ๋“œ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค. ( ์ด์œ ๋Š” ๋ชจ๋ฅด๊ฒ ์ง€๋งŒ ๊ณต๋ถ€์™€ ๊ฒ€์ƒ‰์„ ํ•ด๋ด์•ผ ํ•  ๊ฑฐ ๊ฐ™์Šต๋‹ˆ๋‹ค. )

    ๋”๋ณด๊ธฐ

    M1๋งฅ๋ถ์€ ์• ํ”Œ ์ž์‚ฌ์—์„œ ์ƒ์‚ฐํ•˜๋Š” ARM ๊ธฐ๋ฐ˜์œผ๋กœ ๋Œ์•„๊ฐ‘๋‹ˆ๋‹ค. CPU๊ฐ€ ๋‹ฌ๋ผ์ ธ์„œ ๋นŒ๋“œํ•  ๋•Œ ์‚ฌ์šฉ๋˜๋Š” CPU์˜ ์•„ํ‚คํ…์ฒ˜๋„ ๋ณ€ํ•˜๊ฒŒ ๋˜๋ฉด์„œ arm64๋ฅผ ์‚ฌ์šฉํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

    Excluded Architectures์—์„œ arm64๋ฅผ ์ž…๋ ฅํ•ด์ค๋‹ˆ๋‹ค.

     

    ๋ฏธ ์„ค์ • ์‹œ ์˜ค๋ฅ˜ ๋‚ด์šฉ

    ๋”๋ณด๊ธฐ

    DaumMap.embeddedframework/DaumMap.framework/DaumMap(MTMapView.o), building for iOS Simulator, but linking in object file built for iOS, for architecture arm64

     

    Framework Search Paths์—    $(PROJECT_DIR)/DaumMap.embeddedframework์„ ์ ์–ด์ค๋‹ˆ๋‹ค.

     

    โ€ป $(PROJECT_DIR)/DaumMap.embeddedframework  - ์กฐ๊ฑด์€ ํ”„๋ ˆ์ž„์›Œํฌ ํด๋” ์•„๋ž˜์— DaumMap.embeddedframework ํด๋” ์•„๋ž˜  DaumMap / ๋ฆฌ์†Œ์Šค ํด๋”๊ฐ€ ์žˆ์–ด์•ผ ๋นŒ๋“œ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค. 

     

    ์˜ค๋ฅ˜ ๋‚ด์šฉ

    ๋”๋ณด๊ธฐ
    ๊ฒฝ๋กœ๊ฐ€ ์ž˜๋ชป๋˜๊ฑฐ๋‚˜ ํ—ค๋”๋ฅผ ์ž˜๋ชป ๋งŒ๋“ค๊ฑฐ๋‚˜ ๋“ฑ๋“ฑ ์—ฌ๋Ÿฌ๊ฐ€์ง€ ์ด์œ ๋กœ DaumMap/MTMapView.h file not found๊ฐ€ ์—†๋‹ค๋Š” ์˜ค๋ฅ˜๊ฐ€ ์ •๋ง ์—ฌ๋Ÿฌ๋ฒˆ ๋œฐ์ˆ˜์žˆ์Šต๋‹ˆ๋‹ค.

     

    11. ๋งต์„ ํ™”๋ฉด์— ๋„์šฐ๊ธฐ ์œ„ํ•ด ViewController์— ์ฝ”๋“œ ์ž‘์„ฑํ•˜๊ธฐ

    import UIKit
    
    class ViewController: UIViewController, MTMapViewDelegate {
        
        var mapView: MTMapView?
        
        override func viewDidLoad() {
            super.viewDidLoad()
            
            
            mapView = MTMapView(frame: self.view.bounds)
            if let mapView = mapView {
                mapView.delegate = self
                mapView.baseMapType = .standard
                self.view.addSubview(mapView)
            }
        }
    
    
    }

    ๋นŒ๋“œ๊ฐ€ ์„ฑ๊ณต์ ์œผ๋กœ ๋˜๋ฉด์„œ ๊ฒฐ๊ณผ ํ™”๋ฉด์ž…๋‹ˆ๋‹ค.

     

     

    ์นด์นด์˜ค ๋งต์„ ๊ตฌํ˜„ํ•˜๋ฉด์„œ ์ •๋ง ๋‹ค์–‘ํ•œ ์˜ค๋ฅ˜์™€ ๊ฒ€์ƒ‰์„ ํ†ตํ•ด ํ•˜๋‚˜์”ฉ ์ฐพ์œผ๋ฉด์„œ ํ•ด๊ฒฐํ•ด๊ฐ€๋Š” ๊ณผ์ •์„ ๊ฒช์—ˆ์Šต๋‹ˆ๋‹ค.

    ๊ฒฝํ—˜์„ ํ•ด๋ด„์œผ๋กœ์จ ์ข€ ๋” ์„ฑ์žฅํ•  ์ˆ˜ ์žˆ๋Š” ๊ธฐํšŒ๊ฐ€ ๋œ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. 

     

     

Designed by Tistory.