๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ“š Database/Firebase

[Firebase] ํฌ๋ž˜์‰ฌ๋ฆฌํ‹ฑ์Šค ์‚ฌ์šฉํ•ด๋ณด๊ธฐ (Firebase Crashlytics)

by Fomagran ๐Ÿ’ป 2021. 8. 9.
728x90
๋ฐ˜์‘ํ˜•

์•ˆ๋…•ํ•˜์„ธ์š” Foma๐Ÿ‘Ÿ ์ž…๋‹ˆ๋‹ค!

 

์˜ค๋Š˜์€ ์•ฑ์ด ์–ด๋””์„œ ์ถฉ๋Œ๋‚˜๋Š”์ง€ ์–ด๋””์„œ ๋น„์ •์ƒ์ ์œผ๋กœ ์ข…๋ฃŒ๋˜๋Š”์ง€ ๋“ฑ์„ ์ž์„ธํ•˜๊ฒŒ ์„ค๋ช…ํ•ด์ฃผ๋Š”

 

ํŒŒ์ด์–ด๋ฒ ์ด์Šค์˜ ํฌ๋ž˜์‰ฌ๋ฆฌํ‹ฑ์Šค๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฒ•์— ๋Œ€ํ•ด์„œ ์ •๋ฆฌํ•˜๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

 

๋ฐ”๋กœ ์‹œ์ž‘ํ• ๊ฒŒ์š”~


Crashlytics๋ž€?

 

Firebase์—์„œ Crashlytics๋ฅผ ์ด๋ ‡๊ฒŒ ์†Œ๊ฐœํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

 

"Firebase Crashlytics๋Š” ๊ฐ€๋ฒผ์šด ์‹ค์‹œ๊ฐ„ ์˜ค๋ฅ˜ ๋ณด๊ณ  ๋„๊ตฌ๋กœ ์•ฑ ํ’ˆ์งˆ์„ ์ €ํ•˜ํ•˜๋Š” ์•ˆ์ •์„ฑ ๋ฌธ์ œ๋ฅผ ์ถ”์ ํ•˜๊ณ  ์šฐ์„ ์ˆœ์œ„๋ฅผ ์ง€์ •ํ•˜๊ณ  ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋Š” ๋ฐ ๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค. Crashlytics๋Š” ๋น„์ •์ƒ ์ข…๋ฃŒ๋ฅผ ์ง€๋Šฅ์ ์œผ๋กœ ๊ทธ๋ฃนํ™”ํ•˜๊ณ  ์ด๋Ÿฌํ•œ ๋น„์ •์ƒ ์ข…๋ฃŒ๋ฅผ ์œ ๋ฐœํ•˜๋Š” ์ƒํ™ฉ์„ ๊ฐ•์กฐํ•˜์—ฌ ๋ณด์—ฌ์ฃผ๋ฏ€๋กœ ๋ฌธ์ œํ•ด๊ฒฐ ์‹œ๊ฐ„์ด ์ ˆ์•ฝ๋ฉ๋‹ˆ๋‹ค.
ํŠน์ • ๋น„์ •์ƒ ์ข…๋ฃŒ๊ฐ€ ์—ฌ๋Ÿฌ ์‚ฌ์šฉ์ž์—๊ฒŒ ์˜ํ–ฅ์„ ๋ฏธ์น˜๋Š”์ง€ ํ™•์ธํ•ด ๋ณด์„ธ์š”. ๋ฌธ์ œ์˜ ์‹ฌ๊ฐ๋„๊ฐ€ ๊ธ‰๊ฒฉํžˆ ์ฆ๊ฐ€ํ•˜๋ฉด ์•Œ๋ฆผ์ด ์ „์†ก๋ฉ๋‹ˆ๋‹ค. ์–ด๋–ค ์ฝ”๋“œ ์ค„์ด ๋น„์ •์ƒ ์ข…๋ฃŒ๋ฅผ ์ผ์œผํ‚ค๋Š”์ง€ ํŒŒ์•…ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค."

 

์ฆ‰, ํฌ๋ž˜์‰ฌ๋ฆฌํ‹ฑ์Šค๋Š” ์œ ์ €๊ฐ€ ๋น„์ •์ƒ์ ์œผ๋กœ ์ข…๋ฃŒ๋˜์—ˆ์„ ๋•Œ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์•Œ๋ ค์ฃผ๋Š” ์˜ค๋ฅ˜ ๋ณด๊ณ  ๋„๊ตฌ์ž…๋‹ˆ๋‹ค.


Crashlytics ์‚ฌ์šฉํ•˜๊ธฐ

 

๋จผ์ € Firebase ์ฝ˜์†”๋กœ ์ด๋™ํ•ด์„œ Crashlytics ํƒญ์„ ๋ˆŒ๋Ÿฌ์ค๋‹ˆ๋‹ค.

 

 

๊ทธ๋ฆฌ๊ณค ํ•ด๋‹น  ์•ฑ์„ ๊ณจ๋ผ์ฃผ์‹  ๋’ค Crashlytics ์‚ฌ์šฉ ์„ค์ •์„ ๋ˆŒ๋Ÿฌ์ค๋‹ˆ๋‹ค.

 


Podfile

 

ํŒŸํŒŒ์ผ์— Analytics์™€ Crashlytics๋ฅผ ๋ชจ๋‘ ์ถ”๊ฐ€ํ•ด์ค๋‹ˆ๋‹ค.

 

(Crashlytics ์‚ฌ์šฉ ํ™˜๊ฒฝ์„ ์ตœ์ ํ™”ํ•˜๋ ค๋ฉด Firebase ํ”„๋กœ์ ํŠธ์—์„œ Google ์• ๋„๋ฆฌํ‹ฑ์Šค๋ฅผ ์‚ฌ์šฉ ์„ค์ •ํ•˜๊ณ  Google ์• ๋„๋ฆฌํ‹ฑ์Šค์šฉ Firebase pod๋ฅผ ์•ฑ์— ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.)

 

  pod 'Firebase/Analytics'
  
  pod 'Firebase/Crashlytics'

 

๊ทธ๋ฆฌ๊ณค ํ•ด๋‹น ํ”„๋กœ์ ํŠธ๋กœ ์ด๋™ํ•ด์„œ ํŒŸ์„ ์„ค์น˜ํ•ด์ค๋‹ˆ๋‹ค.

 

pod install

Xcode

 

์ด์ œ Xcode ํ•ด๋‹น  ํ”„๋กœ์ ํŠธ๋กœ ์ด๋™ํ•˜์…”์„œ Target - Build Settings - Debug Information Format ์œผ๋กœ ์ด๋™ํ•ด์ค๋‹ˆ๋‹ค.

 

 

์ด๋™ํ•˜์‹  ๋’ค Debug,Release ๋ชจ๋‘ DWARF with dSYM File๋กœ ๋ฐ”๊ฟ”์ฃผ์„ธ์š”.

 

 

์ด์ œ Build Phases๋ฅผ ์ด๋™ํ•˜์‹  ๋’ค ์™ผ์ชฝ ์ƒ๋‹จ +๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ์„œ ์ƒˆ๋กœ์šด Run Script Phase๋ฅผ ๋งŒ๋“ค์–ด์ค๋‹ˆ๋‹ค.

 

 

์—ฌ๊ธฐ์— ์•„๋ž˜์™€ ๊ฐ™์ด ๋„ฃ์–ด์ฃผ์„ธ์š”.

 

"${PODS_ROOT}/FirebaseCrashlytics/run"
"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp "${PROJECT_DIR}/GoogleService-Info.plist" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"

 

 

Run Script ์•„๋ž˜ input files์— ์•„๋ž˜์— ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋ถ™์—ฌ ๋„ฃ์–ด์ฃผ์„ธ์š”.

 

${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}

 

$(SRCROOT)/$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)

AppDelegate

 

์•ฑ ๋”œ๋ฆฌ๊ฒŒ์ดํŠธ์— Firebase๋ฅผ import ํ•ด์ค๋‹ˆ๋‹ค.

 

import Firebase

 

didFinishLaunchingWithOptions ๋ฉ”์„œ๋“œ์— FirebaseApp.configure() ๋ฅผ ์‹คํ–‰์‹œ์ผœ์ค๋‹ˆ๋‹ค.

 

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        FirebaseApp.configure()
        ...

Test

 

์•„๋ž˜ ์ฝ”๋“œ๋ฅผ ๋ถ™์—ฌ๋„ฃ์–ด Crash ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด ๊ฐ•์ œ๋กœ ๋น„์ •์ƒ ์ข…๋ฃŒ๋˜๋„๋ก ํ•ฉ๋‹ˆ๋‹ค.

 

    let button = UIButton(type: .roundedRect)
        button.frame = CGRect(x: 20, y: 50, width: 100, height: 30)
        button.setTitle("Crash", for: [])
        button.addTarget(self, action: #selector(self.crashButtonTapped(_:)), for: .touchUpInside)
        view.addSubview(button)
        
	@IBAction func crashButtonTapped(_ sender: AnyObject) {
        fatalError()
    	}

Fireabse Console

 

์ด์ œ ํŒŒ์ด์–ด๋ฒ ์ด์Šค ์ฝ˜์†”์˜ Crashlytics๋กœ ์ด๋™ํ•ด์„œ ๋Œ€์‰ฌ๋ณด๋“œ๋ฅผ ํ™•์ธํ•˜๋ ค๊ณ  ํ–ˆ๋”๋‹ˆ...

 

(ํ•œ 10๋ถ„์ •๋„ ๊ธฐ๋‹ค๋ฆฐ๊ฑฐ ๊ฐ™์•„์š”)

 

์•„๋ž˜์™€ ๊ฐ™์ด dSYM์ด ๋ˆ„๋ฝ๋˜์—ˆ๋‹ค๊ณ  ํ•˜๋”๋ผ๊ตฌ์š”...

 

(์ด๊ฒŒ ์ž๋™์œผ๋กœ ์•ˆ์˜ฌ๋ผ๊ฐˆ ๋•Œ๊ฐ€ ์žˆ์–ด์„œ ์ˆ˜๋™์œผ๋กœ ์˜ฌ๋ ค์ค˜์•ผ ํ•  ๋•Œ๊ฐ€ ์žˆ๋‹ค๋„ค์š”..)

 

 

App Store Connect์˜ TestFlight๋กœ ์ด๋™ํ•ด์ค๋‹ˆ๋‹ค.

 

์šฐ์ธก ํ•˜๋‹จ์— dSYM ๋‹ค์šด๋กœ๋“œ๊ฐ€ ์žˆ์„๊ฑฐ์—์š”.

 

๋‹ค์šด๋ฐ›์•„ ์ค๋‹ˆ๋‹ค.

 


Terminal

 

ํ„ฐ๋ฏธ๋„๋กœ ์ด๋™ํ•ด์„œ ํ•ด๋‹น ํ”„๋กœ์ ํŠธ๋กœ ์ด๋™ํ•ด์ค๋‹ˆ๋‹ค.

 

๊ทธ๋ฆฌ๊ณค Pods/FirebaseCrashlytics/upload-symbols -gsp "GoogleService-Info.plist๊ฐ€ ์žˆ๋Š” ๊ฒฝ๋กœ" -p ios "appDsyms๊ฐ€ ์žˆ๋Š” ๊ฒฝ๋กœ"๋ฅผ ์ ์–ด์ค๋‹ˆ๋‹ค.

 

(๊ฒฝ๋กœ๋Š” ํด๋”์— ์žˆ๋Š” ํŒŒ์ผ์„ ๊ฐ€์ ธ๋‹ค ๋Œ๋ฉด ์ž๋™์œผ๋กœ ์ž…๋ ฅ๋ฉ๋‹ˆ๋‹ค.)

 

 

๊ทธ๋Ÿฌ๋ฉด ์•„๋ž˜์™€ ๊ฐ™์ด Successfully uploaded Crashlytics symbols๋ผ๊ณ  ๋œฐ๊ฑฐ์—์š”.

 

 

์Šคํƒ ์˜ค๋ฒ„ ํ”Œ๋กœ์šฐ๋‚˜ ๊นƒํ—™ ํ† ๋ก ์„ ๊ตฌ๊ธ€๋ง ํ•ด์„œ ์ด๋ ‡๊ฒŒ ํ•˜๊ณ  ๋ฉฐ์น ์ด ์ง€๋‚˜์•ผ ๋œ๋‹ค๊ณ  ํ•˜๋”๋ผ๊ตฌ์š”..

 

dSYM์ด ์—…๋กœ๋“œ ๋  ๋•Œ๊นŒ์ง€ ๊ธฐ๋‹ค๋ ค ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค!

 

ํ˜น์‹œ๋ผ๋„ ํ•ด๊ฒฐ๋ฒ•์„ ์•„์‹œ๋Š” ๋ถ„์€ ๋Œ“๊ธ€๋กœ ์•Œ๋ ค์ฃผ์„ธ์š”

 


8์›” 19์ผ ์ˆ˜์ •

 

ํ•œ ์ผ์ฃผ์ผ์ด ์ง€๋‚˜๋„ ํ•ด๊ฒฐ์ด ์•ˆ๋˜๊ธธ๋ž˜ ๋‚ด๊ฐ€ ๋ญ˜ ์ž˜๋ชปํ–ˆ๋‚˜๋ณด๋‹คํ•˜๊ณ  ๊นŒ๋จน์—ˆ๋‹ค๊ฐ€

 

์šฐ์—ฐํžˆ ํ•œ 10์ผ์ฏค ์ง€๋‚œ ์˜ค๋Š˜ ๋“ค์–ด๊ฐ€๋ณด๋‹ˆ ํ•ด๊ฒฐ์ด ๋˜์–ด์žˆ์—ˆ๋‹ค.... ๊ทธ๋ƒฅ ๊ธฐ๋‹ค๋ฆฌ๋ฉด ๋˜๊ตฌ๋‚˜..

 

ํ™•์ธํ•ด๋ณด๋‹ˆ ๋น„์ •์ƒ ์ข…๋ฃŒ์— ๋Œ€ํ•œ ์ •๋ณด๋ฅผ ์ž์„ธํžˆ ์•Œ๋ ค์คฌ์Šต๋‹ˆ๋‹ค.

 

  • ๋ฒ„์ „์ •๋ณด
  • ์˜ํ–ฅ์„ ๋ฐ›์€ ์‚ฌ์šฉ์ž ์ˆ˜
  • ์‹ฌ๊ฐํ•จ ์ •๋„
  • ์ปจํŠธ๋กค๋Ÿฌ ์ •๋ณด
  • ์ค„
  • ๋ฉ”์†Œ๋“œ

 

๋˜ํ•œ ๋ฌธ์ œ๋ฅผ ํด๋ฆญํ•ด์„œ ๋“ค์–ด๊ฐ€๋ณด๋ฉด ๋น„์ •์ƒ ์ข…๋ฃŒ๋˜๋Š” ์“ฐ๋ ˆ๋“œ ์Šคํƒ, ๋””๋ฐ”์ด์Šค ์ •๋ณด๊นŒ์ง€ ์•Œ๋ ค์คฌ์Šต๋‹ˆ๋‹ค.

 

 

์ด๋ ‡๊ฒŒ ์ž์„ธํ•œ ์ •๋ณด๋ฅผ ๋ณด๋‹ˆ ํฌ๋ž˜์‰ฌ๊ฐ€ ์–ผ๋งˆ๋‚˜ ์ผ์–ด๋‚˜๊ณ  ์–ด๋–ป๊ฒŒ ํ•ด๊ฒฐํ•ด์•ผํ• ์ง€ ์œ ์šฉํ•˜๋”๋ผ๊ตฌ์š”.

 

ํ˜น์‹œ๋ผ๋„ ๊ถ๊ธˆํ•˜์‹  ์ ์ด ์žˆ๋‹ค๋ฉด ๋Œ“๊ธ€๋กœ ์•Œ๋ ค์ฃผ์„ธ์š”!


Reference

 

 

Firebase Crashlytics ์‹œ์ž‘ํ•˜๊ธฐ

iOS Android Unity ์ด ๋น ๋ฅธ ์‹œ์ž‘์—์„œ๋Š” Firebase Crashlytics SDK๋ฅผ ์‚ฌ์šฉํ•ด ์•ฑ์— Firebase Crashlytics๋ฅผ ์„ค์ •ํ•˜์—ฌ Firebase Console์—์„œ ํฌ๊ด„์ ์ธ ๋น„์ •์ƒ ์ข…๋ฃŒ ๋ณด๊ณ ์„œ๋ฅผ ํ™•์ธํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์„ค๋ช…ํ•ฉ๋‹ˆ๋‹ค. ์‹œ์ž‘ํ•˜๊ธฐ ์ „์— ์•„

firebase.google.com

 

728x90
๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€