ReactNativeでIOSアプリのプッシュ通知を実装する

4bf9f85356f5a7c959b73f19f4c0df37?s=47 masarufuruya
July 14, 2017
950

 ReactNativeでIOSアプリのプッシュ通知を実装する

4bf9f85356f5a7c959b73f19f4c0df37?s=128

masarufuruya

July 14, 2017
Tweet

Transcript

  1. ReactNativeͰ IOSΞϓϦͷϓογϡ௨஌Λ࣮૷͢Δ

  2. ݹՈ େ ; Δ ΍ ·͞Δ ࣗݾ঺հ ϑϦʔϥϯεΤϯδχΞ ͓࢓ࣄ ReactͷϑϩϯτΤϯυ։ൃ͕ଟΊ

    ࠷ۙ͸React Native΍VRΛֶशத झຯ
  3. ʮࠓ೔ͷςʔϚʯ ReactNativeͰ IOSΞϓϦͷϓογϡ௨஌Λ࣮૷͢Δ

  4. ϓογϡ௨஌ͷ֓ཁ • Apple Push Notification Service (APNs) • Firebase Cloud

    Messaging (FCM)
  5. ϓογϡ௨஌ͷ֓ཁ • Apple Push Notification Service (APNs) • Firebase Cloud

    Messaging (FCM) IOS/Android྆ରԠͰ͖ΔFCMΛ࢖͏
  6. ϓογϡ௨஌ͷ֓ཁ FCM ࣗલαʔόʔ or Sass ᶃ σόΠετʔΫϯͷऔಘ

  7. ϓογϡ௨஌ͷ֓ཁ FCM ࣗલαʔόʔ or Sass ᶄ σόΠετʔΫϯͷొ࿥

  8. ϓογϡ௨஌ͷ֓ཁ FCM ࣗલαʔόʔ or Sass ᶅ Πϕϯτͷൃੜ ᶆ ϓογϡͷཁٻ

  9. ϓογϡ௨஌ͷ֓ཁ FCM ࣗલαʔόʔ or Sass ᶇ ϓογϡ௨஌ (ϝοηʔδ)

  10. ϓογϡ௨஌ͷ֓ཁ ࣗલαʔόʔ or Sass ReactNative ࠓճͷ࿩͸͜͜ͷ෦෼ FCM

  11. FCM͔Β௨஌Λड͚औΔ·Ͱͷखॱ 1. ReactNativeϓϩδΣΫτͷ࡞੒ 2. FCMͷ։ൃ؀ڥηοτΞοϓ 3. react-native-fcmͷηοτΞοϓ 4. ௨஌༻ͷReactίϯϙʔωϯτ࣮૷

  12. ReactNativeϓϩδΣΫτͷ࡞੒ • react-native init IOSNotification • react-native run-ios ※ىಈ·Ͱ݁ߏ͔͔࣌ؒΔͷͰؾ௕ʹ଴ͪ·͠ΐ͏

  13. • XCodeͷBundle Identifier ΛόϯυϧIDཝʹೖྗ FCMͷ։ൃ؀ڥηοτΞοϓ • ReactNativeΞϓϦͱFCM ͕͜ΕͰඥͮ͘

  14. FCMͷ։ൃ؀ڥηοτΞοϓ • CocoaPodsΛ࢖͏ • pod ‘Firebase/Messaging’ FCM㲗IOSؒͷ௨৴Λ Մೳʹ͢ΔϥΠϒϥϦ

  15. react-native-fcmͷηοτΞοϓ • yarn add react-native-fcm • react-native link react-native-fcm IOS

    FCM React IOSͰड͚औͬͨFCMͷ௨஌ΛReactʹ౉ͨ͢ΊͷϥΠϒϥϦ link!
  16. react-native-fcmͷηοτΞοϓ • ެࣜHPΛࢀߟʹAppDelegateϑΝΠϧͷमਖ਼ • RCTBundleURLProvider.h not found౳ ͷΤϥʔ͕୔ࢁग़Δ͕ແࢹͯ͠ਐΜͰOK

  17. ௨஌༻ͷReactίϯϙʔωϯτ࣮૷ • FCM.requestPermissions • Ϣʔβʔ΁ͷ௨஌ڐՄϦΫΤετ

  18. • Objective-C΍Xcodeͷ஌͕ࣝແ͍ͱਏ͍ • ࣮ػϏϧυ͕ࣦഊ͠·ͬͯ͘ਏ͍ • ࣮ػͰṖͷΫϥογϡ͕සൃͯ͠ਏ͍ • Ͱ΋ɺUIपΓΛReactͰॻ͚Δͷ͸޾ͤ ࠓճτϥΠͯ͠Έͯͷॴײ

  19. ͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ