Upgrade to Pro — share decks privately, control downloads, hide ads and more …

モバイルアプリのオブザーバビリティを向上させるプラクティス

nade
September 12, 2022

 モバイルアプリのオブザーバビリティを向上させるプラクティス

https://fortee.jp/iosdc-japan-2022/proposal/6bafac07-06f1-4846-964e-78dccfb29185

【iOSDC Japan 2022 09/12 11:25〜 Track E レギュラートーク(20分)】
近年、SRE(Site Reliability Engineering)の手法をアプリケーションにまで拡大しようといった動きが盛んです

しかし、実際にモバイルアプリの可観測性≒オブザーバビリティを向上させるためには、ネイティブエンジニアの専門性が求められる場面が多く、あまり実際に効果のあった事例が共有されていないように感じます

このトークでは
- アプリ内で計測される指標を用いてSLI / SLOを構成する
- アプリ内でのレスポンスのパースエラー検知
- 問い合わせ調査のオブザーバビリティ向上
- 外部SNSの認証サービスの障害検知
- App Store Connect API 、MeticKitの活用
といった実際にチームで効果のあったプラクティスを紹介したいと思います

nade

September 12, 2022
Tweet

More Decks by nade

Other Decks in Programming

Transcript

  1. ϞόΠϧΞϓϦͷΦϒβʔόϏςΟ
    Λ޲্ͤ͞ΔϓϥΫςΟε


    iOSDC JAPAN 2022
    nade


    @kazuma_nagano

    View full-size slide

  2. ࣗݾ঺հ
    ͳͰʢ @kazuma_nagano ʣ


    ॴଐ


    ● αΠόʔΤʔδΣϯτ


    ○ λοϓϧ


    ■ SREνʔϜ


    ● iOSΤϯδχΞ


    ● ࠷ۙ͸BFFΛKMMܦ༝ͰiOS͔Βݺͼग़࣮͢૷ΛҰ௨Γ
    ॻ͘τϦϦϯΨϧͳΤϯδχΞΛ΍ͬͯ·͢

    View full-size slide

  3. SREॴଐͷϞόΠϧΤϯδχΞʹ
    ● SREνʔϜʹϞ
    バ
    ΠϧΤϯ
    ジ
    χΞ(iOSɺAndroid֤1ਓ)
    が
    ઐଐ
    で
    ॴଐ͢Δܗ


    ● ϛογϣϯ͸ʮαʔϏεͷ৴པੑͷ޲্ʯ

    ❌ ϞόΠϧͷج൫։ൃɺϦΞʔΩςΫνϟਪਐɺQA

    View full-size slide

  4. SRE NEXT 2022
    https://www.youtube.com/watch?v=mjUGAItLWhQ

    View full-size slide

  5. ͦ΋ͦ΋SREͬͯͳΜ͚ͩͬʁ

    View full-size slide

  6. SREͱ͸ʁ from wikipedia
    ● αΠτɾϦϥΠΞϏϦςΟɾΤϯδχΞϦϯάʢӳɿSite Reliability Engineeringɺ
    ུɿSREʣ͸ɺGoogle͕ࣾఏএɺ࣮ફ͍ͯ͠ΔγεςϜ؅ཧͱαʔϏεӡ༻ͷํ๏
    ࿦Ͱ͋Δ


    ● αΠτϦϥΠΞϏϦςΟΤϯδχΞϦϯάΛ୲౰͢ΔΤϯδχΞΛαΠτϦϥΠΞϏ
    ϦςΟΤϯδχΞʢSREʣͱݺͿ
    https://ja.wikipedia.org/wiki/αΠτϦϥΠΞϏϦςΟΤϯδχΞϦϯά

    View full-size slide

  7. Site Reliability Engineering
    ● ʮαΠτɺαʔ
    ビ
    εͷ৴པੑΛकΔ ʯ


    ● Googleʹ͓͚ΔDevOpsΛ࣮ફ͢ΔνʔϜ


    ○ 2004೥͔Β͋ΔΒ͍͠


    ● ಠࣗͷӡ༻
    プ
    ϥΫςΟε͕·ͱ·ͬͯΔ

    e.g.) SLI / SLO, SLA, ΤϥʔόδΣοτɺɺɺ

    → ʮαʔϏεͷՄ༻ੑʯΛͲ͏ଛͳΘͣʹ࡞Γଓ͚Δ͔ʁ

    View full-size slide

  8. Site Reliability Engineering
    https://sre.google

    View full-size slide

  9. ϞόΠϧʹ͓͚ΔSREʁ

    View full-size slide

  10. Engineering Reliable Mobile Applications
    ● GoogleͷSREνʔϜͷߟ͑ΔϞ
    バ
    ΠϧΞ
    プ
    Ϧʹ͓͚Δ
    SREͱ͸Կ͔ʁ


    ● ৴པੑͷ؍఺͔ΒΈͨ࣌ͷWebΞϓϦͱͷҧ͍


    ● Case Studies
    https://www.oreilly.com/library/view/engineering-reliable-mobile/9781492057444/

    View full-size slide

  11. WebΞϓϦͱͷҧ͍ɺɺʁ

    View full-size slide

  12. ϞόΠϧΞϓϦͷ৴པੑΊͬͪΌϜζΠ

    😇

    View full-size slide

  13. Ϟ
    バ
    ΠϧΞ
    プ
    ϦͳΒ
    で
    ͸ͷ೉͠͞

    デ
    バ
    Πε਺ɺϞ
    デ
    ϧͷछྨଟ͗͢


    ○ ෆ۩߹ͷ࠶ݱ΍ݪҼಛఆ͕ࠔ೉


    ● ίϯτϩʔϧͰ͖ͳ͗͢͞


    ○ Ϟ
    バ
    Πϧ͸Ξο
    プデ
    ʔτͷλΠϛϯ
    グ
    ΍ద༻͸Ϣʔ
    ザ
    ࣍ୈ


    ● ϞχλϦϯάେม͗͢


    ○ ϋʔ
    ド
    ΢ΣΞͷछྨɺঢ়ଶɺOSɺෳ਺
    バ
    ʔ
    ジ
    ϣϯͱϩ
    グが
    ଟ࣍ݩ


    ● มߋ؅ཧΉͣա͗


    ○ Ϟ
    バ
    Πϧʹ͸ϩʔϧϑΥϫʔ
    ド
    ͔͠ͳ͍ ɺมߋʹඞཁͳϦʔ
    ド
    λΠϜ΋௕͍

    View full-size slide

  14. ωΠςΟϒͷΤϯδχΞͷྗͳͯ͘͠


    ʮ৴པੑͷ୲อʯΛߦ͏ͷ͸ࠔ೉

    View full-size slide

  15. ϞόΠϧΞϓϦͷΦϒβʔόϏςΟ
    Λ޲্ͤ͞ΔϓϥΫςΟε


    iOSDC JAPAN 2022
    nade


    @kazuma_nagano

    View full-size slide

  16. ࠓճͷΰʔϧ
    ࠓճͷΰʔϧ


    ໌೔͔ΒωΠςΟϒΤϯδχΞͷօ͞Μ͕αʔϏεͷ৴པੑΛ޲্Ͱ͖ΔΑ͏ʹͳΔ


    ֓ཁ


    ● ϞόΠϧαʔϏεʹ͓͚ΔΦϒβʔόϏϦςΟͱ͸ʁ


    ● ΦϒβʔόϏϦςΟͷ࣮ݱʹඞཁͳ̏ͭͷཁૉ


    ● λοϓϧͰऔΓ૊ΜͰ͍ΔͦΕͧΕͷཁૉ΁ͷΞϓϩʔνͷ঺հ

    View full-size slide

  17. ΦϒβʔόϏϦςΟͱ͸ʁ

    View full-size slide

  18. ΦϒβʔόϏϦςΟͱ͸ʁ
    Wikipedia


    ͋ΔγεςϜͷ֎෦ग़ྗʹؔ͢Δ஌͔ࣝΒɺͦͷγεςϜͷ಺෦ঢ়ଶΛͲΕ͚ͩ
    ͏·͘ਪଌͰ͖Δ͔Λࣔ͢ई౓


    Google

    νʔϜ͕γεςϜͷσόοάΛੵۃతʹߦ͑ΔΑ͏ʹ͢Δπʔϧ΍ٕज़తͳ

    ιϦϡʔγϣϯ
    https://en.wikipedia.org/wiki/Observability
    https://cloud.google.com/architecture/devops/devops-measurement-monitoring-and-observability

    View full-size slide

  19. ΦϒβʔόϏϦςΟͷ޲্
    ద੾ͳΦϒβʔόϏϦςΟΛ࣮ݱ͢Δʹ͸ɺ࣍ͷ΋ͷ͕ඞཁ

    Ϩϙʔτ


    ● γεςϜશମͷঢ়ଶʢػೳ͍ͯ͠Δ͔ɺϦιʔεෆ଍͕ͳ͍͔ʣ


    ● γεςϜͷϢʔβʔମݧʢར༻Ͱ͖Δ͔ʁૢ࡞্ͷ໰୊͸ͳ͍͔ʁʣ


    ϞχλϦϯά


    ● ओͳϏδωεࢦඪͱγεςϜࢦඪ


    τϨʔε


    ● ຊ൪؀ڥͷγεςϜͷঢ়ଶΛ֬ೝͯ͠σόοάͰ͖Δπʔϧ


    ● ͜Ε·ͰೝࣝͰ͖ͳ͔ͬͨ͜ͱΛ֬ೝͰ͖Δπʔϧ


    ● ຊ൪؀ڥͷ໰୊ͷτϨʔεɺ֬ೝɺ਍அʹ໾ཱͭπʔϧ

    View full-size slide

  20. ͜ͷ̏ͭΛϞόΠϧΤϯδχΞͷྗͰ֦ு͢Δ

    View full-size slide

  21. ҰൠతͳΦϒβʔόϏϦςΟͷ੹຿ൣғ
    όοΫΤϯυϕʔεͷΦϒβʔόϏϦςΟͱͷൺֱ
    UI / UX Server Apps Infra
    ● Request Latency


    ● Success Rate


    ● CPU Usage


    ● DB Connection

    View full-size slide

  22. ཧ૝తͳΦϒβʔόϏϦςΟ
    όοΫΤϯυϕʔεͷΦϒβʔόϏϦςΟͱͷൺֱ
    UI / UX Server Apps Infra
    ● Request Latency


    ● Success Rate


    ● CPU Usage


    ● DB Connection
    ΞϓϦ಺෦Ͱى͖͍ͯΔ໰୊

    ࣮ࡍͷϢʔβʔମݧ

    View full-size slide

  23. ࣮ࡍͷϓϥΫςΟε঺հ

    View full-size slide

  24. ΦϒβʔόϏϦςΟͷ޲্
    ద੾ͳΦϒβʔόϏϦςΟΛ࣮ݱ͢Δʹ͸ɺ࣍ͷ΋ͷ͕ඞཁ

    Ϩϙʔτ


    ● γεςϜશମͷঢ়ଶʢػೳ͍ͯ͠Δ͔ɺϦιʔεෆ଍͕ͳ͍͔ʣ


    ● γεςϜͷϢʔβʔମݧʢར༻Ͱ͖Δ͔ʁૢ࡞্ͷ໰୊͸ͳ͍͔ʁʣ


    ϞχλϦϯά


    ● ओͳϏδωεࢦඪͱγεςϜࢦඪ


    τϨʔε


    ● ຊ൪؀ڥͷγεςϜͷঢ়ଶΛ֬ೝͯ͠σόοάͰ͖Δπʔϧ


    ● ͜Ε·ͰೝࣝͰ͖ͳ͔ͬͨ͜ͱΛ֬ೝͰ͖Δπʔϧ


    ● ຊ൪؀ڥͷ໰୊ͷτϨʔεɺ֬ೝɺ਍அʹ໾ཱͭπʔϧ

    View full-size slide

  25. ఆظతͳϝτϦΫε֬ೝ

    View full-size slide

  26. ఆظతͳϝτϦΫε֬ೝ
    ● ຖϦϦʔε͝ͱʹόοΫΤϯυɺωΠςΟϒͦΕͧΕͰγεςϜͷϝτϦΫεࢦඪͷ
    ֬ೝΛߦ͏


    ● ֬ೝͨ͠΋ͷΛϨϙʔτͱͯ͠։ൃνʔϜʹڞ༗ɺ஝ੵ͍ͯ͘͠

    View full-size slide

  27. ࢀߟ) ϝτϦΫε֬ೝͰݟ͍ͯΔ΋ͷ
    શମ


    ● DAU


    όοΫΤϯυ


    ● APMʢApplication Performance Managementʣ


    ● ֤छΠϯϑϥͷεςʔλε

    View full-size slide

  28. ࢀߟ) ϝτϦΫε֬ೝͰݟ͍ͯΔ΋ͷ
    ωΠςΟϒ


    ● Firebase Crashlytics


    ○ Ϋϥογϡ཰


    ● Firebase Performance


    ○ ىಈ଎౓ɺωοτϫʔΫ଎౓ɺϨϯμϦϯά଎౓


    ● Xcode Metrics


    ○ Battery Usage, Disk Write, Hang Rate, Launch Time, Memory, Scrolling, Terminations


    ● ͦͷଞ


    ○ ΞϓϦαΠζʢϦϦʔεϏϧυͷipaαΠζʣ

    View full-size slide

  29. Xcode Organizer

    View full-size slide

  30. ݟΔ৔ॴ͕෼͔Εͯͯେมͦ͏ʂ


    🖋🍍ͱײͨͦ͜͡ͷ͋ͳͨ🍎🖋

    View full-size slide

  31. ߹ମͰ͖·͢ʂ


    🖋🍍🍎🖋

    View full-size slide

  32. App Store Connect API

    View full-size slide

  33. 1ͭͷμογϡϘʔυʹू໿
    Firebase


    Xcode Metrics
    Firebase
    Performance
    Firebase
    Crashlytics
    User
    Crash
    Key Metrics
    Google Data Portal
    Auto Export
    BigQuery
    Intermediate table
    BigQuery
    =
    Intermediate table
    BigQuery
    App Store Connect API
    Google Data Portal

    View full-size slide

  34. 1ͭͷμογϡϘʔυʹू໿
    FastlaneͰApp Store Connect APIͰMetricsΛऔಘͯ͠DataDogʹϩάΛૹΔExample


    https://github.com/kazumanagano/FetchAppstoreMetricAction

    View full-size slide

  35. ఆظతͳϝτϦΫε֬ೝ
    ஫ҙ఺


    ● ݸʑʹ֬ೝ͢Δ͚ͩ͡Όͳ͘૬ޓʹى͖͏ΔӨڹʹؔ͢ΔίϛϡχέʔγϣϯΛͱΔ


    ྫʣ


    ● ϦΫΤετ਺ͷ૿Ճ → ViewModelͷϝϞϦʔϦʔΫىҼ


    ● ը૾αΠζͷංେԽ → ΩϟογϡʹΑΔϝϞϦރׇʹΑΔΫϥογϡ

    View full-size slide

  36. ϞχλϦϯά΁ͷΞϓϩʔν

    View full-size slide

  37. ΦϒβʔόϏϦςΟͷ޲্
    ద੾ͳΦϒβʔόϏϦςΟΛ࣮ݱ͢Δʹ͸ɺ࣍ͷ΋ͷ͕ඞཁ

    Ϩϙʔτ


    ● γεςϜશମͷঢ়ଶʢػೳ͍ͯ͠Δ͔ɺϦιʔεෆ଍͕ͳ͍͔ʣ


    ● γεςϜͷϢʔβʔମݧʢར༻Ͱ͖Δ͔ʁૢ࡞্ͷ໰୊͸ͳ͍͔ʁʣ


    ϞχλϦϯά


    ● ओͳϏδωεࢦඪͱγεςϜࢦඪ


    τϨʔε


    ● ຊ൪؀ڥͷγεςϜͷঢ়ଶΛ֬ೝͯ͠σόοάͰ͖Δπʔϧ


    ● ͜Ε·ͰೝࣝͰ͖ͳ͔ͬͨ͜ͱΛ֬ೝͰ͖Δπʔϧ


    ● ຊ൪؀ڥͷ໰୊ͷτϨʔεɺ֬ೝɺ਍அʹ໾ཱͭπʔϧ

    View full-size slide

  38. ϞόΠϧΞϓϦͷSLI / SLOߏங

    View full-size slide

  39. ϞόΠϧΞϓϦͷSLI / SLOߏங
    SLI / SLOͱ͸


    SLI(Service Level Indicator) : αʔ
    ビ
    εͷՄ༻ੑɺ඼࣭Λܭଌ͢Δࢦඪ


    SLO(Service Level Objective) : ֤SLIʹର͢Δ໨ඪ஋


    View full-size slide

  40. ϞόΠϧΞϓϦͷSLI / SLOߏங
    ϞόΠϧΞϓϦͷՄ༻ੑ


    View full-size slide

  41. ϞόΠϧΞϓϦͷSLI / SLOߏங
    Մ༻ੑͷఆٛΛ޿͛Δ


    Ξ
    プ
    Ϧέʔγϣϯ
    が
    ར༻Մೳ
    で
    ͳ͍ঢ়ଶͷྫ


    ● ΞΠίϯΛλο
    プ
    ͨ͠
    が
    ɺΞ
    プ
    Ϧ
    が
    ͳ͔ͳ͔ىಈ͠ͳ͍

    => ىಈ࣌ؒ



    ボ
    λϯΛλο
    プ
    ͯ͠΋ɺΞ
    プ
    Ϧ
    が
    ൓Ԡ͢Δؾ഑
    が
    ͳ͍

    => ը໘଺ࡏ࣌ؒ


    ● ͭͶʹԿ΋ͳ͍ը໘
    が
    දࣔ͞Ε͍ͯͯɺίϯςϯπ
    が
    ݟΕͳ͍

    => ϨεϙϯεͷύʔεΤϥʔ


    ● ಈ͖
    が
    ΋ͬ͞Γ͢͠
    ぎ
    ͯ࢖͍෺ʹͳΒͳ͍

    => ϑϨʔϜͷϨϯ
    ダ
    Ϧϯ
    グ
    ଎౓

    View full-size slide

  42. ϞόΠϧΞϓϦͷSLI / SLOߏங
    Մ༻ੑͷఆٛΛ޿͛Δ


    Ξ
    プ
    Ϧέʔγϣϯ
    が
    ར༻Մೳ
    で
    ͳ͍ঢ়ଶͷྫ


    ● ΞΠίϯΛλο
    プ
    ͨ͠
    が
    ɺΞ
    プ
    Ϧ
    が
    ͳ͔ͳ͔ىಈ͠ͳ͍

    => ىಈ࣌ؒ



    ボ
    λϯΛλο
    プ
    ͯ͠΋ɺΞ
    プ
    Ϧ
    が
    ൓Ԡ͢Δؾ഑
    が
    ͳ͍

    => ը໘଺ࡏ࣌ؒ


    ● ͭͶʹԿ΋ͳ͍ը໘
    が
    දࣔ͞Ε͍ͯͯɺίϯςϯπ
    が
    ݟΕͳ͍

    => ϨεϙϯεͷύʔεΤϥʔ


    ● ಈ͖
    が
    ΋ͬ͞Γ͢͠
    ぎ
    ͯ࢖͍෺ʹͳΒͳ͍

    => ϑϨʔϜͷϨϯ
    ダ
    Ϧϯ
    グ
    ଎౓

    View full-size slide

  43. ͞Βʹ޿͛Δͱɺɺ

    View full-size slide

  44. Մ༻ੑ ⊃ ϢʔβʔͷUXͷظ଴஋

    View full-size slide

  45. ϞόΠϧΞϓϦͷSLI / SLOߏங
    Ϣʔβʔͷظ଴͢ΔUXΛΧόʔ͢ΔՄ༻ੑͷఆٛ


    ϝϯόʔ͔ΒʮαʔϏεͷՄ༻ੑʯͷٵ্͍͛


    ● औΓ͍ͨࢦඪɺఆٛɺܭଌํ๏ɺѱԽͨ͠৔߹ʹଛͳΘΕΔUXΛώΞϦϯά


    ● ϑΥʔΧε͢ΔࢦඪɺίΞͳମݧΛ࢈ΜͰ͍ΔUXΛܾఆ͢Δ


    View full-size slide

  46. Մ༻ੑΛ΋ͱʹͨ͠SLIΛઃఆ
    ڞ௨


    ● Ϋϥογϡ / ANR


    ػೳ͝ͱͷΩʔϝτϦΫε

    ྫ)


    ● ϝοηʔδ: ಡΈࠐΈ଎౓


    ● ΧʔυϑϦοΫ: ࠶ϑϦοΫՄೳʹͳΔ·Ͱͷ࣌ؒ

    View full-size slide

  47. SLIҧ൓Λ࠶ݱͨ͠ΞϓϦΛ࢖ͬͨSLOܾΊ
    ● աڈͷΠϯγσϯτ࣌ͷࢦඪ΍ɺࣄલώΞϦϯά͔Βɺ͖͍͠஋ʹ͋ͨΓΛ͚ͭΔ

    ● σόοάػೳͰৄࡉͳ͖͍͠஋Λௐ੔ՄೳͳΞϓϦΛ༻ҙ͠ɺ৮Γͳ͕Βٞ࿦

    View full-size slide

  48. FirebaseΛ࢖ͬͨՄ༻ੑͷܭଌྫ

    View full-size slide

  49. Ξϥʔτͷઃఆͷࣗ༝౓
    Firebase Performance


    ● ࡞੒ͨ͠ࢦඪ͝ͱʹΞϥʔτͷઃఆ͕Մೳ


    ● ͖͍͠஋Λ50ʙ95ύʔηϯλΠϧͷࢦఆ͕Մೳ


    Firebase Crashlytics


    ● ௚ۙ1࣌ؒͷηογϣϯʹର͢ΔΫϥογϡ཰


    ● ͖͍͠஋Λ0.1%ʙ1.0%ͰίϯτϩʔϧՄೳ

    View full-size slide

  50. Ϋϥογϡϩάͷ෼ྨ
    https://firebase.google.com/docs/crashlytics/customize-crash-reports
    import UIKit


    import FirebaseCrashlytics


    final class LoginViewController: UIViewController {




    // ը໘Λදࣔ͢ΔλΠϛϯάͰCrashlyticsʹΧελϜΩʔΛઃఆ


    override func viewWillAppear(_ animated: Bool) {


    super.viewWillAppear(animated)


    Crashlytics.crashlytics().setCustomValue("login", forKey: "domain")


    }


    iOSΞϓϦͰͷϩάΠϯը໘ʹର͢Δ࣮૷ྫ
    ֤ػೳͷը໘දࣔ࣌ʹCrashlyticsʹΧελϜΩʔΛઃఆ͢Δ


    ● ΧελϜΩʔΛ΋ͱʹBigQuery (Data Portal) ্ͰػೳυϝΠϯ͝ͱͷΫϥογϡΛूܭ


    ● ػೳ͝ͱͷΞϥʔτ͸ઃఆͰ͖ͳ͍


    ○ Velocity Alert → μογϡϘʔυͰػೳӨڹ֬ೝ

    View full-size slide

  51. τϨʔε΁ͷΞϓϩʔν

    View full-size slide

  52. ΦϒβʔόϏϦςΟͷ޲্
    ద੾ͳΦϒβʔόϏϦςΟΛ࣮ݱ͢Δʹ͸ɺ࣍ͷ΋ͷ͕ඞཁ

    Ϩϙʔτ


    ● γεςϜશମͷঢ়ଶʢػೳ͍ͯ͠Δ͔ɺϦιʔεෆ଍͕ͳ͍͔ʣ


    ● γεςϜͷϢʔβʔମݧʢར༻Ͱ͖Δ͔ʁૢ࡞্ͷ໰୊͸ͳ͍͔ʁʣ


    ϞχλϦϯά


    ● ओͳϏδωεࢦඪͱγεςϜࢦඪ


    τϨʔε


    ● ຊ൪؀ڥͷγεςϜͷঢ়ଶΛ֬ೝͯ͠σόοάͰ͖Δπʔϧ


    ● ͜Ε·ͰೝࣝͰ͖ͳ͔ͬͨ͜ͱΛ֬ೝͰ͖Δπʔϧ


    ● ຊ൪؀ڥͷ໰୊ͷτϨʔεɺ֬ೝɺ਍அʹ໾ཱͭπʔϧ

    View full-size slide

  53. ϨεϙϯεͷύʔεΤϥʔͷݕ஌

    View full-size slide

  54. ϨεϙϯεͷύʔεΤϥʔͷݕ஌
    ● REST APIͷϨεϙϯεΛCodable౳Λ༻͍ͯΫϥΠΞϯτଆʹఆٛ͞Ε͍ͯΔEntity
    ʹύʔε͠Α͏ͱ͢ΔࡍʹඞཁͳεΩʔϚ͕ܽଛ͍ͯͨ͠৔߹ʹड͚औΕͳ͘ͳΔ


    ○ όοΫΤϯυͰ͸ݕ஌͕Ͱ͖ͳ͍


    ● ࠷৽όʔδϣϯͰͷػೳ࡟আ࣌ʹɺաڈόʔδϣϯΞϓϦʹඞཁͳεΩʔϚ͕ܽଛ͢
    ΔͳͲɺόοΫΤϯυͷϦϦʔεىҼͰൃੜ͢Δ


    ○ ϦΞϧλΠϜͳݕ஌͕༗ޮ

    View full-size slide

  55. ύʔεΤϥʔʹΑΔো֐ͷྫ
    ϨεϙϯεͷύʔεΤϥʔͷݕ஌
    // αʔόʔϦϦʔεલ


    {


    "_id": 1234,


    "name": "user"


    }


    // αʔόʔϦϦʔεޙ


    {


    "id": 1234,


    "name": "user"


    }


    struct User: Codable {


    let id: Int


    let name: String


    }


    API Response ͷjson ରԠ͢ΔSwiftଆͷCodable

    View full-size slide

  56. ϨεϙϯεͷύʔεΤϥʔͷݕ஌

    View full-size slide

  57. ϨεϙϯεͷύʔεΤϥʔͷݕ஌

    View full-size slide

  58. ϨεϙϯεͷύʔεΤϥʔͷݕ஌
    do {


    try JSONDecoder().decode(Response.self, from: data)


    } catch {


    var errString = error.localizedDescription


    // dev؀ڥͷΈ࣮ࡍͷϨεϙϯεΛૹ৴


    #if DEBUG


    var jsonString = ""


    if let json = try? JSONSerialization.jsonObject(with: data, options: .allowFragments) {


    jsonString = String(describing: json)


    }


    errString += ", response: \(jsonString)"


    #endif


    // pathதͷidΛਖ਼نԽ


    let normalizedPath = path


    // uuidΛਖ਼نԽ


    .replacingUUID()


    // numberͷidΛਖ਼نԽ


    .replacingNumId()


    Logger.warn(.parseError(endPoint: normalizedPath, message: error.localizedDescription, error: error)


    View full-size slide

  59. Ϣʔβʔ໰͍߹ΘͤௐࠪͷτϨʔαϏϦςΟ޲্

    View full-size slide

  60. Ϣʔβʔ໰͍߹ΘͤௐࠪͷτϨʔαϏϦςΟ޲্
    ● Ϣʔβʔ͔Βෆ۩߹ͷ໰͍߹Θ͕ͤ͋ͬͨ৔߹ʹ࠶ݱ͕Ͱ͖ͳ͍


    ● ໰͍߹ΘͤϢʔβʔͷΞϓϦ಺Ͱ


    ○ ͲͷλΠϛϯάͰ


    ○ ͲΜͳΤϥʔ͕ग़͍ͯΔ͔


    ͕஌Γ͍ͨ

    View full-size slide

  61. Ϣʔβʔ໰͍߹ΘͤௐࠪͷτϨʔαϏϦςΟ޲্
    ● μΠΞϩάʹΤϥʔίʔυΛهࡌ


    ○ Ϣʔβʔ͔ΒεΫϦʔϯγϣοτΛૹͬͯ΋Β͏


    ○ ಉλΠϛϯάͰCrashlyticsʹϩάૹ৴


    ● CrashlyticsͰ೔෇ɺ࣌ؒɺϢʔβʔIDɺΤϥʔίʔυͰ

    ಉ͡λΠϛϯάͰൃੜ͍ͯ͠ΔΤϥʔ಺༰͕ΈΕΔΑ͏ʹ

    View full-size slide

  62. Ϣʔβʔ໰͍߹ΘͤௐࠪͷτϨʔαϏϦςΟ޲্

    View full-size slide

  63. Ϣʔβʔ໰͍߹ΘͤௐࠪͷτϨʔαϏϦςΟ޲্
    ࣮ࡍʹಛఆͰ͖ͨ໰͍߹ΘͤݪҼ


    ● WiFiىҼͷSSLΤϥʔ


    ● ୺຤ͷηΩϡϦςΟιϑτʹΑΔIP੍ݶ


    ● ViewModelͷϝϞϦϦʔΫىҼͷଟॏϦΫΤετ

    View full-size slide

  64. ֎෦SNSͷೝূαʔϏεͷো֐ݕ஌

    View full-size slide

  65. ֎෦ͷೝূαʔϏεͷো֐ݕ஌
    ● ֎෦ͷೝূαʔϏεͷো֐࣌ʹૉૣ͘Ϣʔβʔʹڞ༗͍ͨ͠


    ● ໰͍߹Θ͕ͤ૿͑ΔલʹνʔϜʹঢ়گΛڞ༗͓͖͍ͯͨ͠

    View full-size slide

  66. ֎෦ͷೝূαʔϏεͷো֐ݕ஌
    Ωϟϯηϧ౳ͷط஌ͷΤϥʔݪҼΛϑΟϧλʔͯ͠ϩάૹ৴Λߦ͏
    let authError = error as?
    ASAuthorizationError


    switch authError?.code {


    case .canceled:


    break


    default:


    Logger.warn(


    .snsError(provider: .apple),


    error: error


    )


    }


    let errorCode =
    GIDSignInError.Code(rawValue:
    error.code)


    switch authError?.code {


    case .canceled:


    break


    default:


    Logger.warn(


    .snsError(provider: .apple),


    error: error


    )
    Sign in with Apple Google

    View full-size slide

  67. ֎෦ͷೝূαʔϏεͷো֐ݕ஌
    Ұఆظؒͷϩάͷྔͷฏۉ͔ΒΞϥʔτͷᮢ஋ΛܾΊΔ

    View full-size slide

  68. ·ͱΊ
    ● SREྖҬʹϞόΠϧΤϯδχΞ͕׆༂Ͱ͖ΔྖҬ͕·ͩ·ͩ͋Δ


    ● ΦϒβʔόϏϦςΟΛߏ੒͢ΔϨϙʔτɺϞχλϦϯάɺτϨʔεͷ̏ͭ΁ͷ

    λοϓϧͰऔΓ૊ΜͰ͍Δ5ͭͷΞϓϩʔνͷ঺հ


    1. ϝτϦΫε֬ೝ


    2. SLI / SLOࡦఆ


    3. ύʔεΤϥʔݕ஌


    4. ໰͍߹ΘͤͷτϨʔαϏϦςΟ޲্


    5. ֎෦SNSىҼͷো֐ݕ஌

    View full-size slide

  69. ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠

    Ξϯέʔτ͓଴ͪͯ͠·͢ʂ

    View full-size slide