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

実践 CallKit/PushKit ときどき🐛退治 / iOSDC 2019

monoqlo
September 07, 2019

実践 CallKit/PushKit ときどき🐛退治 / iOSDC 2019

iOSDC JAPAN 2019 2019/09/07 13:30〜 Track E レギュラートーク(30分)

monoqlo

September 07, 2019
Tweet

More Decks by monoqlo

Other Decks in Technology

Transcript

  1. @monoqloʢ΋ͷ͘Ζʣ
    ࣮ફ CallKit/PushKit
    ͱ͖Ͳ͖ୀ࣏
    iOSDC TOKYO 2019

    View full-size slide

  2. PushKit
    CallKit

    View full-size slide

  3. ※ Πϥετ͸ΠϝʔδͰ͢

    View full-size slide

  4. ※ Πϥετ͸ΠϝʔδͰ͢

    View full-size slide

  5. ※ Πϥετ͸ΠϝʔδͰ͢

    View full-size slide

  6. ※ Πϥετ͸ΠϝʔδͰ͢

    View full-size slide

  7. ֤ߏ੒ཁૉͷ֓ཁ

    View full-size slide

  8. 1.CallKit
    2.PushKit
    3.Twilio
    ߏ੒ཁૉ

    View full-size slide

  9. ΞϯϩοΫ࣌ ϩοΫத
    Ԡ౴ޙ
    ண৴த
    ϩοΫத

    View full-size slide

  10. ͜ͷϘλϯ͔Β
    ΞϓϦΛىಈͰ͖Δ

    View full-size slide

  11. ϩοΫதͰͳ͚Ε͹ɺ
    App Switcher Ͱ
    ੾Γସ͑΋Մೳ

    View full-size slide

  12. • iOS 10 ͔Β࢖͑ΔϑϨʔϜϫʔΫ
    • Apple ७ਖ਼ి࿩ΞϓϦͷΑ͏ͳ UI/UX Λ
    ࣮ݱͰ͖Δ
    • ண৴࣌ʹి࿩ΞϓϦͱಉ౳ͷ UI Λදࣔ
    • ௨࿩ཤྺʹදࣔɺཤྺ͔Βର৅ΞϓϦΛ
    ࢦఆͯ͠ൃ৴
    • Call Directory Extension
    • ண৴ڋ൱΍ൃ৴ऀͷࣝผ͕Ͱ͖Δ
    CallKit

    View full-size slide

  13. • iOS 8 ͔Β࢖͑ΔϑϨʔϜϫʔΫ
    • VoIPʹ࠷దͳϓογϡ௨஌͕Ͱ͖Δ
    • ௨ৗͷϓογϡ௨஌ʹൺ΂ɺ͍͔ͭ͘
    ϝϦοτ༗Γ
    PushKit

    View full-size slide

  14. UserNotifications vs. PushKit
    6TFS/PUJpDBUJPOT 1VTI,JU
    Ξϥʔτόοδ
    ௨஌Ի
    දࣔͰ͖Δ /POF
    ஗Ԇ
    ϕετΤϑΥʔτ
    ʢ࣮֬ʹಧ͘อূ΋ͳ͍ʣ
    ΑΓ௿஗Ԇ
    ʢ௨ৗΑΓ΋༏ઌ͞ΕΔʣ
    ϖΠϩʔυ௕ ,# )551
    ,#
    ΞϓϦ͕ࢮΜͰΔ࣌
    ͷڍಈ
    ಛʹԿ΋ͯ͘͠Εͳ͍
    ΞϓϦΛόοΫάϥ΢ϯυ
    Ͱىಈͯ͘͠ΕΔ

    View full-size slide

  15. • ͓खܰʹ VoIP ௨࿩Λ࣮ݱͰ͖Δ Web
    αʔϏε
    • ΫϥΠΞϯτʢϒϥ΢β/iOS/Androidʣ
    ޲͚ʹ SDKɺαʔόʔ޲͚ʹ API ͱϔϧ
    ύʔϥΠϒϥϦ͕ఏڙ͞Ε͍ͯΔ
    Twilio

    View full-size slide

  16. Programmable Voice

    View full-size slide

  17. CallKit/PushKit/(Twilio)
    ͷ࢖͍ํ

    View full-size slide

  18. • WWDC Video
    • υΩϡϝϯτ
    • αϯϓϧίʔυ
    CallKit/PushKit ʹ͍ͭͯௐ΂ͯΈΔ

    View full-size slide

  19. งғؾ͸ WWDC Video
    ΛݟΕ͹ͳΜͱͳ͘Θ͔Δ
    https://developer.apple.com/videos/play/wwdc2016/230/

    View full-size slide

  20. Apple ͷαϯϓϧίʔυ
    ͋ͬͨΑ͏ͳ

    View full-size slide

  21. Enhancing VoIP Apps with CallKit - WWDC 2016 - Videos - Apple
    Developer
    https://developer.apple.com/videos/play/wwdc2016/230/
    Speakerbox ͱ͍͏αϯϓϧίʔυ͕͋Γͦ͏ʁ

    View full-size slide

  22. ͍ͭͷ·ʹ͔
    ͳ͘ͳͬͯͨ
    githubʹ্͛ͯΔਓ͸͍ͨ…

    View full-size slide

  23. Twilioͷαϯϓϧίʔυ
    զʑ͕ਅʹݟΔ΂͖͸

    View full-size slide

  24. • https://github.com/twilio/voice-
    quickstart-swift
    • ࠷௿ݶͷίʔυ͸͜ΕΛࢀߟʹ͓͚ͯ͠͹
    OK ͩͬͨ
    • README ΋ॆ࣮ͯ͠Δ
    Twilio Voice Quickstart for iOS

    View full-size slide

  25. ඞཁ࠷௿ݶͷίʔυ
    αϯϓϧίʔυ͔ΒΘ͔Δ

    View full-size slide

  26. ొ৔ਓ෺
    • CXProvider
    • CXCallController
    • PKPushRegistry
    ֎෦ىҼͷཁٻΛγεςϜʹ఻͑ɺ
    γεςϜ͔ΒͷཁٻΛ֎෦ʹ఻͑Δਓ
    ΞϓϦىҼͷཁٻΛγεςϜʹ఻͑Δਓ
    VoIP ϓογϡ௨஌Ͱ͖ΔΑ͏ʹ͢Δਓ

    View full-size slide

  27. https://developer.apple.com/videos/play/wwdc2016/230/

    View full-size slide

  28. ண৴=>Ԡ౴=>௨࿩ऴྃ ͷྫ

    View full-size slide

  29. https://developer.apple.com/videos/play/wwdc2016/230/

    View full-size slide

  30. https://developer.apple.com/videos/play/wwdc2016/230/

    View full-size slide

  31. https://developer.apple.com/videos/play/wwdc2016/230/

    View full-size slide

  32. let configuration =
    CXProviderConfiguration(localizedName: “App Name”)
    configuration.includesCallsInRecents = false
    configuration.maximumCallGroups = 1
    configuration.maximumCallsPerCallGroup = 1
    configuration.iconTemplateImageData = UIImage(named:
    “AppLogo")!.pngData()
    self.provider = CXProvider(configuration: configuration)
    self.provider.setDelegate(self, queue: nil)
    CXProvider ͷ४උ

    View full-size slide

  33. self.callController = CXCallController()
    CXCallController ͷ४උ

    View full-size slide

  34. extension VoiceCallManager: PKPushRegistryDelegate {
    func pushRegistry(_ registry: PKPushRegistry,
    didUpdate pushCredentials: PKPushCredentials, for type:
    PKPushType) {
    guard type == .voIP else { return }
    let deviceToken = (pushCredentials.token as
    NSData).description
    // ϓογϡ௨஌ड͚औΕΔΑ͏ʹαʔόʔ౉͢
    }
    }
    }
    PKPushRegistryDelegate ͷ४උ

    View full-size slide

  35. extension VoiceCallManager: PKPushRegistryDelegate {
    func pushRegistry(_ registry: PKPushRegistry,
    didReceiveIncomingPushWith payload: PKPushPayload, for
    type: PKPushType, completion: @escaping () -> Void) {
    if type == .voIP {
    // ண৴ը໘Λදࣔ͢Δ
    //
    reportNewIncomingCall(with:update:completion:) Λίʔϧ
    }
    completion()
    }
    }
    PKPushRegistryDelegate ͷ४උ

    View full-size slide

  36. extension VoiceCallManager: CXProviderDelegate {
    func providerDidReset(_ provider: CXProvider) {
    // Ի੠༗ޮԽ
    }
    func provider(_ provider: CXProvider, didActivate
    audioSession: AVAudioSession) {
    // Ի੠༗ޮԽ
    }
    func provider(_ provider: CXProvider, didDeactivate
    audioSession: AVAudioSession) {
    // Ի੠ແޮԽ
    }
    }
    CXProviderDelegate ͷ४උ

    View full-size slide

  37. extension VoiceCallManager: CXProviderDelegate {
    func provider(_ provider: CXProvider, perform action:
    CXSetMutedCallAction) {
    // ϛϡʔτON/OFFॲཧ
    action.fulfill()
    }
    func provider(_ provider: CXProvider, perform action:
    CXAnswerCallAction) {
    // Ԡ౴ޙͷॲཧ.͜ͷλΠϛϯάͰ͸·ͩԻ੠ΛແޮԽ͓ͯ͘͠
    action.fulfill()
    }
    }
    CXProviderDelegate ͷ४උ

    View full-size slide

  38. extension VoiceCallManager: CXProviderDelegate {
    func provider(_ provider: CXProvider, perform
    action: CXStartCallAction) {
    // ൃ৴ॲཧΛͯ͠CallKitʹ఻͑Δ
    provider.reportOutgoingCall(with:
    action.callUUID, startedConnectingAt: Date())
    provider.reportOutgoingCall(with:
    action.callUUID, connectedAt: Date())
    action.fulfill()
    }
    }
    CXProviderDelegate ͷ४උ

    View full-size slide

  39. extension VoiceCallManager: CXProviderDelegate {
    func provider(_ provider: CXProvider, perform action:
    CXEndCallAction) {
    // ੾அޙͷॲཧ
    action.fulfill()
    }
    func provider(_ provider: CXProvider, perform
    action: CXSetHeldCallAction) {
    // อཹON/OFFॲཧ
    action.fulfill()
    }
    }
    CXProviderDelegate ͷ४උ

    View full-size slide

  40. let voipRegistry = PKPushRegistry(queue: .main)
    voipRegistry.delegate = self
    voipRegistry.desiredPushTypes = Set([.voIP])
    self.voIPPushRegistry = voipRegistry
    // ௨ৗ਺ඵҎ಺ʹҎԼͷσϦήʔτϝιου͕ίʔϧ͞ΕΔ
    // func pushRegistry(_ registry: PKPushRegistry,
    didUpdate pushCredentials: PKPushCredentials, for type:
    PKPushType)
    VoIP Push ௨஌ͷొ࿥

    View full-size slide

  41. let callHandle = CXHandle(type: .generic, value: "໊લ")
    let startCallAction = CXStartCallAction(call: uuid,
    handle: callHandle)
    let transaction = CXTransaction(action: startCallAction)
    self.callController.request(transaction) { error in
    if let error = error {
    return
    }
    let callUpdate = CXCallUpdate()
    callUpdate.remoteHandle = callHandle
    self.provider.reportCall(with: uuid, updated:
    callUpdate)
    // CXProviderDelegate ͷ provider(_ provider:
    CXProvider, perform action: CXStartCallAction) ͕ίʔϧ͞
    ΕΔ
    }
    ൃ৴͢Δ

    View full-size slide

  42. let callHandle = CXHandle(type: .generic, value: "ి࿩͔
    ͚͖ͯͯΔਓͷ໊લ”)
    let callUpdate = CXCallUpdate()
    callUpdate.remoteHandle = callHandle
    // ௨࿩ΛಛఆͰ͖ΔUUIDΛࣄલʹ෷͍ग़͓ͯ͘͠
    self.provider.reportNewIncomingCall(with: uuid, update:
    callUpdate) { error in
    // Τϥʔ͕ൃੜ͍ͯ͠ͳ͚Ε͹ɺ͜͜ͰԻ੠௨࿩Λ։࢝͢Δ
    }
    ண৴ը໘Λදࣔ͢Δ

    View full-size slide

  43. • Enhancing VoIP Apps with CallKit - WWDC 2016 -
    Videos - Apple Developer
    https://developer.apple.com/videos/play/wwdc2016/230/
    • twilio/voice-quickstart-swift: Twilio Voice
    Quickstart for iOS with Swift
    https://github.com/twilio/voice-quickstart-swift
    ৄ͘͠͸

    View full-size slide

  44. • ֤छಈ࡞ʹ͍ͭͯͷυΩϡϝϯτ͕΄΅ͳ͍
    • զʑ͸Τεύʔ͢Δ͔͠ͳ͍ʢڍಈΛ
    ͻͨ͢Β֬ೝʣ
    • ૝ఆ֎ͷڍಈ΍όάʹରॲͰ͖ͳ͍Մೳ
    ੑ͕͋ΔͨΊɺͻͱͭͻͱͭख࡞ۀͰ֬
    ೝ͢Δඞཁ͕͋ͬͨ
    • ࣮૷ࣗମΑΓ΋ίί͕େ͖ͳίετ
    • ࣮ػͰ͔͠ UI ΛදࣔͰ͖ͳ͍
    CallKit Tips

    View full-size slide

  45. ͋ͱͰ௨஌ Ϙλϯ
    • ϦϚΠϯμʔΞϓϦ
    ʹొ࿥͢Δػೳͳͷ
    Ͱ஫ҙ
    • ڍಈͷΧελϚΠ
    ζ͸Ͱ͖ͳ͍
    • ඇදࣔʹ΋Ͱ͖ͳ
    ͍

    View full-size slide

  46. • VoIP Push௨஌ূ໌ॻ͸ຊ൪؀ڥͱαϯυ
    ϘοΫεڞ௨
    • VoIP Push௨஌͸ೝূΩʔະରԠͷͨΊɺ
    ຖ೥ূ໌ॻΛߋ৽͢Δඞཁ͕͋Δ
    PushKit Tips

    View full-size slide

  47. ূ໌ॻ伴ͷ؅ཧ
    ೝূ伴Λ
    ൒Ӭٱతʹ࢖͑Δ
    ຖ೥ূ໌ॻͷߋ৽͕ඞཁ
    6TFS/PUJpDBUJPOT 1VTI,JU
    Ξϥʔτόοδ
    ௨஌Ի
    දࣔͰ͖Δ /POF
    ஗Ԇ
    ϕετΤϑΥʔτ
    ʢ࣮֬ʹಧ͘อূ΋ͳ͍ʣ
    ΑΓ௿஗Ԇ
    ʢ௨ৗΑΓ΋༏ઌ͞ΕΔʣ
    ϖΠϩʔυ௕ ,# )551
    ,#
    ΞϓϦ͕ࢮΜͰΔ࣌
    ͷڍಈ
    ಛʹԿ΋ͯ͘͠Εͳ͍
    ΞϓϦΛόοΫάϥ΢ϯυ
    Ͱىಈͯ͘͠ΕΔ

    View full-size slide

  48. • ίϯιʔϧ্Ͱ͸ূ໌ॻͷظݶΛ֬ೝͰ͖ͳ
    ͍
    • ొ࿥໊ʹ೔෇ΛೖΕΔ͜ͱͰ୭͕ݟͯ΋
    ظݶ೔͕Θ͔ΔΑ͏ʹ
    • ߋ৽๨ΕΔͱେࢂࣄͳͷͰɺੲͷAPNs࣌୅
    Λࢥ͍ग़ͯ͠ɺͦΕͧΕ͓޷Έͷํ๏ͰϦϚ
    ΠϯμʔΛઃఆ͠·͠ΐ͏
    Twilio Tips

    View full-size slide

  49. • VoIP Push௨஌ূ໌ॻΛຊ൪؀ڥͰ࢖͏͔α
    ϯυϘοΫεͰ࢖͏͔બ୒Λؒҧ͑ͳ͍͜ͱ
    • ίϯιʔϧ্ͰνΣοΫΛೖΕؒҧ͑Δ
    ͱϓογϡ௨஌ඈΜͰ͜ͳ͍ͷͰ஫ҙ
    • ಧ͔ͳ͍࣌͸·ͣ͸͜͜Λٙ͏
    Twilio Tips

    View full-size slide

  50. ޮ཰తͳσόοάํ๏
    2"

    View full-size slide

  51. CallKit ͷ UI Λ
    खܰʹ֬ೝ͍ͨ͠ΜͰ͕͢

    Q1.

    View full-size slide

  52. reportNewIncomingCall(
    with:update:completion:)
    A.

    View full-size slide

  53. let callHandle = CXHandle(type: .generic,
    value: "͔͚͖ͯͯΔਓͷ໊લ”)
    let callUpdate = CXCallUpdate()
    callUpdate.remoteHandle = callHandle
    callUpdate.supportsDTMF = false
    callUpdate.supportsHolding = true
    callUpdate.supportsGrouping = false
    callUpdate.supportsUngrouping = false
    callUpdate.hasVideo = false
    self.provider.reportNewIncomingCall(with:
    UUID(), update: callUpdate) { error in
    // Τϥʔ͕ൃੜ͠ͳ͚Ε͹ɺ࣮ࡍ͸͜͜ͰԻ੠௨࿩
    Λ։࢝͢Δ
    }

    View full-size slide

  54. • CallKit ͷண৴/௨࿩த UI Λ֬ೝ͢Δ͚ͩͳΒ
    ؆୯
    • CXProvider ͷ͜ͷϝιουΛୟ͚ͩ͘
    • reportNewIncomingCall(with:update:c
    ompletion:)
    ௨࿩ͤͣʹ CallKit ͷ UI ͸֬ೝͰ͖Δ

    View full-size slide

  55. • ௨࿩த UI ͔Βͷૢ࡞ʢ͋ͱͰ௨஌ ΍ ੾அ
    ͳͲʣ΋͔֬ΊΒΕΔ
    • UI Λૢ࡞͢Δͱ֤छ delegate ϝιου
    ͕ίʔϧ͞ΕΔͷͰɺ࣮૷͠ͳ͍ or
    σόοάઐ༻ʹ͓ͯ͘͠ඞཁ͸͋Δ
    ௨࿩ͤͣʹ CallKit ͷ UI ͸֬ೝͰ͖Δ

    View full-size slide

  56. ࣮ࡍʹ௨࿩͕ඞཁͳಈ࡞֬ೝ
    ΊͪΌͪ͘Όେม͡Όͳ͍Ͱ͔͢

    Q2.

    View full-size slide

  57. • ೋ୆ඞཁͱ͍͏࣌఺ͰͭΒ͍(
    • ผΞϓϦͰׂࠐ௨࿩ࢼ͢ʹ͸ߋʹΞΧ΢ϯτ
    ͕2ͭඞཁ…
    • ͻͱΓ͝ͱ΍͹͍ਓʹͳΔͷͰڧ͍৺͕ඞཁ
    • ϋ΢Ϧϯά໰୊΋͋Δ
    ࣮ࡍʹ௨࿩͕ඞཁͳέʔε͸Ͳ͏͢Δʁ

    View full-size slide

  58. ࣗಈԻ੠Λྲྀ͢
    A.

    View full-size slide

  59. • Twilioʹ͸ࣗಈͰԻ੠Λྲྀ͢ػೳ͕͋Δ
    • ࢦఆͷ࿈བྷઌʹ௨࿩Λൃ৴͠ɺ૬ख͕௨࿩ʹ
    ग़ͨΒࣗಈԻ੠΍༧Ί༻ҙͨ͠Ի੠ϑΝΠϧ
    Λ࠶ੜͰ͖Δ
    Twilio Programmable Voice

    View full-size slide



  60. Thanks for trying our
    documentation. Enjoy!
    http://demo.twilio.com/docs/classic.mp3
    Play>

    TwiMLʢthe Twilio Markup Languageʣ
    http://demo.twilio.com/docs/voice.xml

    View full-size slide

  61. from twilio.rest import Client
    account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
    auth_token = 'your_auth_token'
    client = Client(account_sid, auth_token)
    call = client.calls.create(
    url='http://demo.twilio.com/docs/voice.xml',
    to=‘client:xxxxxxxxx’,
    from_='client:debug_call'
    )
    Python Ͱ௨࿩Λൃ৴͢Δ

    View full-size slide

  62. • ࣗ਎ʹ௨࿩͕͔͔ͬͯ͘Δ API
    • σόοάը໘͔Β API Λୟ͘ͱ
    ண৴
    • ΞϓϦ͕ऴ͍ྃͯ͠Δঢ়ଶͰண
    ৴΋Ͱ͖ΔΑ͏ʹɺAPI ʹ͸Կ
    ඵޙʹண৴͢Δ͔ࢦఆͰ͖Δύ
    ϥϝʔλΛ༻ҙ
    ண৴ϦΫΤετ API Λ༻ҙ

    View full-size slide

  63. • ୺຤2୆༻ҙ͢Δඞཁͳ͠
    • ϋ΢Ϧϯάͷ৺഑ͳ͠
    • CallKit ͷڍಈΛௐ΂Δͷ΋͓खܰ
    ࣗ෼ͷ੠͕ಧ͘ͷ͔Ͳ͏͔ɺϛϡʔτͰ͖͍ͯΔ͔
    Ͳ͏͔ͳͲ͸ɺ͕͢͞ʹ2୆Ͱ͓ࢼ͍ͩ͘͠͞
    ௨࿩֬ೝ͍ͨ͠ͳΒࣗಈԻ੠Λྲྀ͢

    View full-size slide

  64. Α͠Α͠ɺྑ͍ײ͡ʹ
    ࣮૷Ͱ͖͖ͯͨͧ☺

    View full-size slide


  65. ݺΜͩʁ
    ͓ؼΓ͍͖͍ͨͩͨ

    View full-size slide

  66. ʮ௨࿩தʹผͷΞϓϦ͕ண৴͠ɺอཹʹͯ͠ผ
    ΞϓϦͰ௨࿩ͨ͠ޙɺ௨࿩ऴྃͯ͠΋อཹ͕ղ
    আ͞Εͳ͍ʯ
    QA தʹͱ͋Δใࠂ…

    View full-size slide

  67. ͝ΊΜ੔ཧͤͯ͞

    View full-size slide

  68. 1. ௨࿩தʹి࿩΍ผͷ CallKit ରԠΞϓϦ͕
    ண৴͠ɺׂΓࠐΈ௨࿩Λ։࢝͢Δʢ΋ͱ΋
    ͱ௨࿩͍ͯͨ͠ΞϓϦ͸͜ͷλΠϛϯάͰ
    อཹʹͳΔʣ
    2. ૬ख͔Β௨࿩Λ੾ͬͯ΋Β͏
    3. ͳ͔ͥอཹ͕ղআ͞Εͳ͍
    • ࣗ෼Ͱ੾ͬͨ৔߹͸อཹ͕ղআ͞ΕΔ
    ঢ়گ೺Ѳ

    View full-size slide

  69. • ͦ΋ͦ΋อཹͷ ON/OFF ͸ iOS ͕ࣗಈͰߦͬͯ
    ͍ΔͷͰ͸ͳ͘ɺΞϓϦͰ੍ޚ͍ͯ͠Δ
    • CXProviderDelegate ͕ͳΜ͔͓͔͍͠ʁ
    ݪҼΛ୳Δ

    View full-size slide

  70. • provider(_ provider: CXProvider,
    didDeactivate audioSession:
    AVAudioSession)
    => อཹON
    • provider(_ provider: CXProvider,
    didActivate audioSession:
    AVAudioSession)
    => อཹOFF
    อཹ ON/OFF ͷτϦΨʔ

    View full-size slide

  71. 1. MOV௨࿩தʹి࿩΍ผͷCallKitରԠΞϓ
    Ϧ͕ண৴͠ɺׂΓࠐΈ௨࿩Λ։࢝͢Δ
    2. ૬ख͔Β௨࿩Λ੾ͬͯ΋Β͏
    ໰୊ൃੜͷৄࡉ

    View full-size slide

  72. 3. ͳ͔ͥ provider(_ provider: CXProvider,
    didDeactivate audioSession:
    AVAudioSession) ͕࣮ߦ͞Εɺอཹ͕ղআ
    ͞Εͳ͍
    • ࣗ෼Ͱ੾ͬͨ৔߹͸ provider(_ provider:
    CXProvider, didActivate audioSession:
    AVAudioSession) ͕࣮ߦ͞ΕΔͷͰอཹ͕ղআ͞
    ΕΔ
    ໰୊ൃੜͷৄࡉ

    View full-size slide

  73. ଞͷΞϓϦΛݟͯΈΔ
    Facebook Messenger ͱ͔ LINE ͱ͔

    View full-size slide

  74. • ͦ΋ͦ΋อཹΛڐՄ͍ͯ͠ͳ͍
    • CXCallUpdate ͷ supportsHolding Λ
    false ʹ͍ͯ͠Δ
    Facebook Messenger

    View full-size slide

  75. let callHandle = CXHandle(type: .generic,
    value: "͔͚͖ͯͯΔਓͷ໊લ”)
    let callUpdate = CXCallUpdate()
    callUpdate.remoteHandle = callHandle
    callUpdate.supportsDTMF = false
    callUpdate.supportsHolding = true
    callUpdate.supportsGrouping = false
    callUpdate.supportsUngrouping = false
    callUpdate.hasVideo = false
    self.provider.reportNewIncomingCall(with:
    UUID(), update: callUpdate) { error in
    // Τϥʔ͕ൃੜ͠ͳ͚Ε͹ɺ࣮ࡍ͸͜͜ͰԻ੠௨࿩
    Λ։࢝͢Δ
    }

    View full-size slide

  76. • ׂΓࠐΈ௨࿩͕੾ΕɺΞϓϦ͕ϑΥΞάϥ΢ϯυ
    ʹͳͬͨΒڧ੍తʹอཹΛղআ͍ͯ͠ΔʢΑ͏ʹ
    ݟ͑Δʣ
    • ୺຤ϩοΫதͩͱ΍͸Γอཹͷ··ʹͳΔ
    • ϩοΫத͸ CallKit ͷ UI ͕ग़ͯ͘ΔͷͰը
    ໘͑͞ݟΕ͹อཹதͰ͋Δ͜ͱ͸Θ͔Δ
    ͠ɺղআ΋Ͱ͖Δ
    LINE

    View full-size slide

  77. 1. Facebook MessengerํࣜɿอཹΛڐՄ͠ͳ͍
    2. LINEํࣜɿΞϓϦ͕ϑΥΞάϥ΢ϯυʹͳͬͨ
    Βڧ੍తʹอཹΛղআ͢Δ
    3. ͦͷଞɿ௨࿩ը໘ʹอཹON/OFFϘλϯΛஔ͘
    ରࡦҊ

    View full-size slide

  78. • ࠓճͷΞϓϦͰ͸LINEํࣜΛ࠾༻
    • ΘΓ͖ΔͳΒFacebook MessengerํࣜͰ
    ΋ྑ͔͔ͬͨ΋͠Εͳ͍
    • ࠓճͷΞϓϦ͸௨࿩͕ϝΠϯػೳͰ͸ͳ
    ͘ɺը໘ͷཁૉΛ૿΍ͨ͘͠ͳ͍ҙਤ΋͋Γ
    อཹϘλϯҊ͸ෆ࠾༻
    ݁ہͲ͏ͨ͠ʁ

    View full-size slide

  79. 88%$Ͱฉ͍ͯΈΔ

    View full-size slide

  80. • ࣮૷͔Β਺Χ݄ޙɺWWDC19ࢀՃ
    • LabͰฉ͘νϟϯε
    όάͳͷ͔ɺ࢓༷ͳͷ͔

    View full-size slide

  81. આ໌͢Δ
    => Apple୲౰ऀࠔ࿭
    => ผͷਓΛݺΜͰΔ
    => ·ͨઆ໌͢Δ
    => ҎԼ3ճ͘Β͍ϧʔϓ
    શһࠔ࿭
    ฉ͍ͯΈ͚ͨͲ…

    View full-size slide

  82. .ʮ࢓༷ͳͷʁʯ
    ʮͦΜͳ͜ͱͳ͍ʯ
    .ʮόάͳͷ…ʁʯ
    ʮόάͩͶʯ
    .ʮόάͳΜ͔͍ʯ
    ࢓༷ʁόάʁ

    View full-size slide

  83. ͱΓ͋͑ͣϑΟʔυόοΫϨϙʔτग़͠·ͨ͠
    ௚Δͷ͔ͳ…
    ͦ͜ʹ͍ͨਓ͕ͨͪ஌Βͳ͍͚ͩͰ࢓༷ͳΜ
    ͡Όͳ͍ͷ
    όάΒ͍͠ͷͰ

    View full-size slide

  84. ͱΓ͋͑ͣϑΟʔυόοΫϨϙʔτग़͠·ͨ͠
    ௚Δͷ͔ͳ…
    ͦ͜ʹ͍ͨਓ͕ͨͪ஌Βͳ͍͚ͩͰ࢓༷ͳΜ
    ͡Όͳ͍ͷ
    όάΒ͍͠ͷͰ

    View full-size slide

  85. • CallKit/PushKit Λ࢖͏ͱ७ਖ਼ి࿩ΞϓϦͷ
    Α͏ͳ UI/UX͕࣮ݱͰ͖Δ
    • ެࣜαϯϓϧίʔυ͸ͳ͍ͷͰɺTwilio ͷ
    αϯϓϧίʔυݟΔͷΦεεϝ
    • σόοά͠΍͍͢؀ڥΛ͓ͭͬͯ͘͘ͱḿΔ
    • CallKit ͷׂࠐ௨࿩όάʢ࢓༷ʣ͸ରॲͯ͠
    ͓͘͜ͱ
    ·ͱΊ

    View full-size slide

  86. J04Ͱ1VTI,JU੍͕ݶ͞ΕΔʁ
    ͓·͚

    View full-size slide

  87. And new this year, it's very important that you
    know that you must report incoming calls with
    CallKit in the didReceiveIncomingPush callback
    or your app will be terminated. And, if you
    repeatedly do this, or if you repeatedly fail not
    to report an incoming call, the system may stop
    launching your app for VoIP pushes altogether.
    WWDCͰͷקࠂ
    https://developer.apple.com/videos/play/wwdc2019/707/

    View full-size slide

  88. • ϓογϡ௨஌͕དྷͨΒ CallKit ͷ UI Λදࣔ͠
    ͳ͍ͱΞϓϦ͕ࡴ͞ΕΔ
    • CallKit UI දࣔʹ܁Γฦࣦ͠ഊ͢ΔͱɺVoIP
    ϓογϡ௨஌ͰΞϓϦ͕ىಈ͢Β͠ͳ͘ͳΔ
    WWDCͰͷקࠂ

    View full-size slide

  89. ͳΜͰ͜Μͳ࢓༷ʹʁ

    View full-size slide

  90. • VoIP Ҏ֎ͷ໨తʹ PushKit Λ࢖͏ΞϓϦ
    ͕͋ͬͨͨΊ੍ݶ͕ೖͬͨ໛༷
    • ΞϓϦΛόοΫάϥ΢ϯυͰىಈͰ͖ͯ
    ͠·͏ͨΊɺҐஔ৘ใऔಘͳͲϢʔβʔͷ
    ݸਓ৘ใऩू໨తͰ࢖ΘΕΔ͜ͱ΋͋Δͱ
    ͔ͳ͍ͱ͔
    ੍ݶ͕ՃΘͬͨཧ༝

    View full-size slide

  91. • WhatsApp ͳͲɺΤϯυπʔΤϯυ҉߸ԽͷͨΊ
    ʹ PushKit Λ࢖͍ͬͯΔΞϓϦ΋͋ͬͨ໛༷
    • όφʔग़͍ͨ͠ʁ Notification Service Extension
    ࢖͍ͳΑ
    Prefer a banner? Use standard pushes
    Notification Service Extension to modify
    content
    ϝοηʔδϯάΞϓϦ΁ͷݗ੍ʁ

    View full-size slide

  92. ฐࣾΞϓϦ΁ͷӨڹ
    ͪͳΈʹ

    View full-size slide

  93. • Twilio SDK ͸ਖ਼نͷखஈͰ࢖͍ͬͯΔ͚ͲӨڹ
    ड͚͍ͯΔ
    • PushKit Λண৴͚ͩͰ͸ͳ͘ɺ௨࿩ΩϟϯηϧͰ
    ΋࢖͍ͬͯͨͷ͕ݪҼ
    iOS 13 & Xcode 11 Breaking Changes – Twilio Support
    https://support.twilio.com/hc/en-us/articles/
    360035005593-iOS-13-Xcode-11-Breaking-Changes
    Twilio ແࣄࢮ๢

    View full-size slide

  94. • Enhancing VoIP Apps with CallKit - WWDC 2016 -
    Videos - Apple Developer
    https://developer.apple.com/videos/play/wwdc2016/230/
    • CallKit | Apple Developer Documentation
    https://developer.apple.com/documentation/callkit
    • PushKit | Apple Developer Documentation
    https://developer.apple.com/documentation/pushkit
    • Energy Efficiency Guide for iOS Apps: Voice Over IP
    (VoIP) Best Practices
    https://developer.apple.com/library/archive/documentation/Performance/
    Conceptual/EnergyGuide-iOS/OptimizeVoIP.html
    References

    View full-size slide

  95. • Twilio - Communication APIs for SMS, Voice, Video
    and Authentication
    https://www.twilio.com
    • Twilioͱ͸ | Twilio for KDDI Web Communications
    https://twilio.kddi-web.com/availability/
    References

    View full-size slide

  96. • twilio/twilio-voice-ios: Programmable Voice SDK by
    Twilio
    https://github.com/twilio/twilio-voice-ios
    • twilio/voice-quickstart-swift: Twilio Voice Quickstart
    for iOS with Swift
    https://github.com/twilio/voice-quickstart-swift
    • PushKit | Apple Developer Documentation
    https://developer.apple.com/documentation/pushkit
    • Energy Efficiency Guide for iOS Apps: Voice Over IP
    (VoIP) Best Practices
    https://developer.apple.com/library/archive/documentation/Performance/
    Conceptual/EnergyGuide-iOS/OptimizeVoIP.html
    References

    View full-size slide

  97. • Local and Remote Notification Programming Guide:
    Creating the Remote Notification Payload
    https://developer.apple.com/library/archive/documentation/
    NetworkingInternet/Conceptual/RemoteNotificationsPG/
    CreatingtheNotificationPayload.html
    • Advances in App Background Execution - WWDC
    2019 - Videos - Apple Developer
    https://developer.apple.com/videos/play/wwdc2019/707/
    • iOS 13 & Xcode 11 Breaking Changes – Twilio
    Support
    https://support.twilio.com/hc/en-us/articles/360035005593-iOS-13-Xcode-11-
    Breaking-Changes
    References

    View full-size slide