{"componentChunkName":"component---src-templates-documentation-tsx","path":"/messaging/usage/ios-setup","result":{"data":{"mdx":{"body":"var _excluded = [\"components\"];\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n/* @jsxRuntime classic */\n/* @jsx mdx */\n\nvar _frontmatter = {\n  \"title\": \"iOS Messaging Setup\",\n  \"description\": \"iOS requires additional configuration steps to be completed before you can receive messages.\",\n  \"next\": \"/messaging/ios-permissions\",\n  \"previous\": \"/messaging/usage\"\n};\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n    props = _objectWithoutProperties(_ref, _excluded);\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"p\", null, \"Integrating the Cloud Messaging module on iOS devices requires additional setup before your devices receive messages.\\nThere are also a number of prerequisites which are required to enable messaging:\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"You must have an active \", mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://developer.apple.com/membercenter/index.action\"\n  }, \"Apple Developer Account\"), \".\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"You may use a physical iOS device to receive messages \", mdx(\"em\", {\n    parentName: \"li\"\n  }, \"or\"), \" an iOS Simulator if you are on macOS 13+ on Apple Silicon using a Simulator running iOS 16+\", mdx(\"ul\", {\n    parentName: \"li\"\n  }, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Firebase Cloud Messaging integrates with the \", mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://developer.apple.com/notifications/\"\n  }, \"Apple Push Notification service (APNs)\"), \",\\nhowever APNs only works with real devices or Apple Silicon macs running relatively new versions\")))), mdx(\"h2\", {\n    \"id\": \"configuring-your-app\"\n  }, \"Configuring your app\"), mdx(\"p\", null, \"Before your application can start to receive messages, you must explicitly enable \\\"Push Notifications\\\" and \\\"Background Modes\\\"\\nwithin Xcode.\"), mdx(\"p\", null, \"Open your project's workspace file via Xcode (found within the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"/ios\"), \" directory). The file name is prefixed with your project name,\\nfor example \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"/ios/myapp.xcworkspace\"), \". Once open, follow the steps below:\"), mdx(\"ol\", null, mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"Select your project.\"), mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"Select the project target.\"), mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"Select the \\\"Signing & Capabilities\\\" tab.\")), mdx(\"p\", null, mdx(\"img\", {\n    parentName: \"p\",\n    \"src\": \"https://images.prismic.io/invertase/c954c8ed-a6bf-42f3-9b1d-c9eac937f9ec_xcode-signing-tab.png?auto=format\",\n    \"alt\": \"Example with Steps\"\n  })), mdx(\"h3\", {\n    \"id\": \"enable-push-notifications\"\n  }, \"Enable Push Notifications\"), mdx(\"p\", null, \"Next the \\\"Push Notifications\\\" capability needs to be added to the project. This can be done via the \\\"Capability\\\" option on the\\n\\\"Signing & Capabilities\\\" tab:\"), mdx(\"ol\", null, mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"Click on the \\\"+ Capabilities\\\" button.\"), mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"Search for \\\"Push Notifications\\\".\")), mdx(\"p\", null, mdx(\"img\", {\n    parentName: \"p\",\n    \"src\": \"https://images.prismic.io/invertase/d682a40c-07ab-4fce-90a7-fb4278643323_xcode-enable-push-notification.png?auto=format\",\n    \"alt\": \"Enabling the Push Notification capability\"\n  })), mdx(\"p\", null, \"Once selected, the capability will be shown below the other enabled capabilities. If no option appears when searching, the\\ncapability may already be enabled.\"), mdx(\"h3\", {\n    \"id\": \"enable-background-modes\"\n  }, \"Enable Background Modes\"), mdx(\"p\", null, \"Next the \\\"Background Modes\\\" capability needs to be enabled, along with both the \\\"Background fetch\\\" and \\\"Remote notifications\\\" sub-modes.\\nThis can be added via the \\\"Capability\\\" option on the \\\"Signing & Capabilities\\\" tab:\"), mdx(\"ol\", null, mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"Click on the \\\"+ Capabilities\\\" button.\"), mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"Search for \\\"Background Modes\\\".\")), mdx(\"p\", null, mdx(\"img\", {\n    parentName: \"p\",\n    \"src\": \"https://images.prismic.io/invertase/517e18ad-37a7-4f44-a89e-c5947ea3742e_xcode-enable-background-modes-capability.png?auto=compress,format\",\n    \"alt\": \"Enabling the Background Modes capability\"\n  })), mdx(\"p\", null, \"Once selected, the capability will be shown below the other enabled capabilities. If no option appears when searching, the\\ncapability may already be enabled.\"), mdx(\"p\", null, \"Now ensure that both the \\\"Background fetch\\\" and the \\\"Remote notifications\\\" sub-modes are enabled:\"), mdx(\"p\", null, mdx(\"img\", {\n    parentName: \"p\",\n    \"src\": \"https://images.prismic.io/invertase/3a618574-dd9f-4478-9f39-9834d142b2e5_xcode-background-modes-check.gif?auto=compress,format\",\n    \"alt\": \"Enabling the sub-modes\"\n  })), mdx(\"h2\", {\n    \"id\": \"linking-apns-with-fcm-ios\"\n  }, \"Linking APNs with FCM (iOS)\"), mdx(\"blockquote\", null, mdx(\"p\", {\n    parentName: \"blockquote\"\n  }, \"Note: APNs is now required for both \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"foreground\"), \" and \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"background\"), \" messaging to function correctly on iOS.\")), mdx(\"p\", null, \"A few steps are required:\"), mdx(\"ol\", null, mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"#1-registering-a-key\"\n  }, \"Registering a key\"), \".\"), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"#2-registering-an-app-identifier\"\n  }, \"Registering an App Identifier\"), \".\"), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"#3-generating-a-provisioning-profile\"\n  }, \"Generating a provisioning profile\"), \".\")), mdx(\"p\", null, \"All of these steps require you to have access to your \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://developer.apple.com/membercenter/index.action\"\n  }, \"Apple Developer\"), \" account.\\nOnce on the account, navigate to the \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://developer.apple.com/account/resources/certificates/list\"\n  }, \"Certificates, Identifiers & Profiles\"), \"\\ntab on the account sidebar:\"), mdx(\"p\", null, mdx(\"img\", {\n    parentName: \"p\",\n    \"src\": \"https://images.prismic.io/invertase/c0a795c8-ebca-41c3-9a8d-23f09deb625f_apple-dev-tab.png?auto=format\",\n    \"alt\": \"Certificates, Identifiers & Profiles menu item\"\n  })), mdx(\"h3\", {\n    \"id\": \"1-registering-a-key\"\n  }, \"1. Registering a key\"), mdx(\"p\", null, \"A key can be generated which gives the FCM full access over the Apple Push Notification service (APNs). On the \\\"Keys\\\" menu item,\\nregister a new key. The name of the key can be anything, however you must ensure the APNs service\\nis enabled:\"), mdx(\"p\", null, mdx(\"img\", {\n    parentName: \"p\",\n    \"src\": \"https://images.prismic.io/invertase/01fefe19-132f-4b88-8c17-9dc40357e4ce_apple-key.png?auto=format\",\n    \"alt\": \"Enable \\\"Apple Push Notification (APNs)\\\"\"\n  })), mdx(\"p\", null, \"Click \\\"Continue\\\" & then \\\"Save\\\". Once saved, you will be presented with a screen displaying the private \\\"Key ID\\\" & the ability\\nto download the key. Copy the ID, and download the file to your local machine:\"), mdx(\"p\", null, mdx(\"img\", {\n    parentName: \"p\",\n    \"src\": \"https://images.prismic.io/invertase/2c7f194c-10a9-4011-8f80-78b8fc521af8_app-key-final.png?auto=format\",\n    \"alt\": \"Copy Key ID & Download File\"\n  })), mdx(\"p\", null, \"The file & Key ID can now be added to your Firebase Project. On the \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://console.firebase.google.com/project/_/settings/cloudmessaging\"\n  }, \"Firebase Console\"), \",\\nnavigate to the \\\"Project settings\\\" and select the \\\"Cloud Messaging\\\" tab. Select your iOS application under the \\\"iOS app configuration\\\" heading.\"), mdx(\"p\", null, \"Upload the downloaded file and enter the Key ID:\"), mdx(\"p\", null, mdx(\"img\", {\n    parentName: \"p\",\n    \"src\": \"https://images.prismic.io/invertase/74bd1df4-c9e9-465c-9e0f-cacf6e26d68c_7539b8ec-c310-40dd-91e5-69f19009786f_apple-fcm-upload-key.gif?auto=compress,format\",\n    \"alt\": \"Upload the key & Key ID\"\n  })), mdx(\"h3\", {\n    \"id\": \"2-registering-an-app-identifier\"\n  }, \"2. Registering an App Identifier\"), mdx(\"p\", null, \"For messaging to work when your app is built for production, you must create a new App Identifier which is linked to the\\napplication that you're developing.\"), mdx(\"p\", null, \"On the \\\"Identifiers\\\" menu item, register a App Identifier. Select the \\\"App IDs\\\" option and click \\\"Continue\\\".\"), mdx(\"p\", null, \"The following screen enables you to link the identifier to your application via the \\\"Bundle ID\\\". This is a unique string\\nwhich was generated when starting your new React Native project. Your Bundle ID can be obtained within Xcode, under the\\n\\\"General\\\" tab for your project target:\"), mdx(\"p\", null, mdx(\"img\", {\n    parentName: \"p\",\n    \"src\": \"https://images.prismic.io/invertase/7108ff7f-ce94-4452-851d-fa5dde668a9a_xcode-bundle-id.png?auto=compress,format\",\n    \"alt\": \"Project Bundle ID\"\n  })), mdx(\"p\", null, \"Next, follow these steps:\"), mdx(\"ol\", null, mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"Enter a description for the identifier.\"), mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"Enter the \\\"Bundle ID\\\" copied from Xcode.\"), mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"Scroll down and enable the \\\"Push Notifications\\\" capability (along with any others your app uses).\")), mdx(\"p\", null, mdx(\"img\", {\n    parentName: \"p\",\n    \"src\": \"https://images.prismic.io/invertase/0e711691-ccd2-43ab-9c0c-7696b6790153_apple-identifier.gif?auto=format\",\n    \"alt\": \"Create an identifier\"\n  })), mdx(\"p\", null, \"Save the identifier, it'll be used when creating a provisioning profile in the next step.\"), mdx(\"h3\", {\n    \"id\": \"3-generating-a-provisioning-profile\"\n  }, \"3. Generating a provisioning profile\"), mdx(\"p\", null, \"A provisioning profile enables signed communicate between Apple and your application. Since messaging can only be used on\\nreal devices, a signed certificate ensures that the app being installed on a device is genuine and has the correct\\npermissions enabled.\"), mdx(\"p\", null, \"On the \\\"Profiles\\\" menu item, register a new Profile. Select the \\\"iOS App Development\\\" checkbox and click \\\"Continue\\\".\"), mdx(\"p\", null, \"If you followed \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"#2-registering-an-app-identifier\"\n  }, \"Step 2\"), \" correctly, your App Identifier will be available in the drop down\\nprovided:\"), mdx(\"p\", null, mdx(\"img\", {\n    parentName: \"p\",\n    \"src\": \"https://images.prismic.io/invertase/9fd060fa-4afa-4dfe-8eaa-4b1156cdd912_apple-select-app-id.png?auto=format\",\n    \"alt\": \"Select the App Identifier\"\n  })), mdx(\"p\", null, \"Click \\\"Continue\\\". On the next screen you will be presented with the Certificates on your Apple account. Select the user\\ncertificates that you wish to assign this provisioning profile too. If you have not yet created a Certificate, you must set\\none up on your account.\"), mdx(\"p\", null, \"To create a new Certificate, follow the \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://help.apple.com/developer-account/#/devbfa00fef7\"\n  }, \"Apple documentation\"), \". Once\\nthe Certificate has been downloaded, upload it to the Apple Developer console via the \\\"Certificates\\\" menu item.\"), mdx(\"p\", null, \"The created provisioning profile can now be used when building your application (in both debug and release mode) onto a\\nreal device (using Xcode). Back within Xcode, select your project target and select the \\\"Signing & Capabilities\\\" tab.\\nIf Xcode (via Preferences) is linked to your Apple Account, Xcode can automatically sync the profile created above. Otherwise,\\nyou must manually add the profile from the Apple Developer console:\"), mdx(\"ol\", null, mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"Select the project.\"), mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"Select the project target.\"), mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"Assign the provisioning profile.\")), mdx(\"p\", null, mdx(\"img\", {\n    parentName: \"p\",\n    \"src\": \"https://images.prismic.io/invertase/50349f49-19a0-45f4-b899-e6bc3015c509_xcode-assign-profile.png?auto=format\",\n    \"alt\": \"Assign the provisioning profile via Xcode\"\n  })), mdx(\"h2\", {\n    \"id\": \"next-steps\"\n  }, \"Next steps\"), mdx(\"p\", null, \"Once the above has been completed, you're ready to get started receiving messages on your iOS device for both\\ntesting and production. To rebuild your app, run the following command:\"), mdx(\"pre\", {\n    \"className\": \"language-bash\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"npx react-native run-ios\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;","frontmatter":{"title":"iOS Messaging Setup","description":"iOS requires additional configuration steps to be completed before you can receive messages.","icon":null,"noindex":null},"excerpt":"Integrating the Cloud Messaging module on iOS devices requires additional setup before your devices receive messages.\nThere are also a…","tableOfContents":{"items":[{"url":"#configuring-your-app","title":"Configuring your app","items":[{"url":"#enable-push-notifications","title":"Enable Push Notifications"},{"url":"#enable-background-modes","title":"Enable Background Modes"}]},{"url":"#linking-apns-with-fcm-ios","title":"Linking APNs with FCM (iOS)","items":[{"url":"#1-registering-a-key","title":"1. Registering a key"},{"url":"#2-registering-an-app-identifier","title":"2. Registering an App Identifier"},{"url":"#3-generating-a-provisioning-profile","title":"3. Generating a provisioning profile"}]},{"url":"#next-steps","title":"Next steps"}]},"headings":[{"depth":2,"value":"Configuring your app"},{"depth":3,"value":"Enable Push Notifications"},{"depth":3,"value":"Enable Background Modes"},{"depth":2,"value":"Linking APNs with FCM (iOS)"},{"depth":3,"value":"1. Registering a key"},{"depth":3,"value":"2. Registering an App Identifier"},{"depth":3,"value":"3. Generating a provisioning profile"},{"depth":2,"value":"Next steps"}],"parent":{"__typename":"File","relativePath":"messaging/usage/ios-setup.md"}},"next":{"frontmatter":{"title":"iOS Permissions"},"fields":{"slug":"/messaging/ios-permissions"}},"previous":{"frontmatter":{"title":"Cloud Messaging"},"fields":{"slug":"/messaging/usage"}},"sidebar":{"raw":"[[\"Getting Started\",\"/\"],[\"Migration Guide to v22\",\"/migrating-to-v22\"],[\"Migration Guide to v23\",\"/migrating-to-v23\"],[\"TypeScript\",\"/typescript\"],[\"Platforms\",\"/platforms\"],[\"Release Notes\",\"/releases\"],[\"FAQs and Tips\",\"/faqs-and-tips\"],[\"Feature Requests\",\"https://invertase.canny.io/react-native-firebase\"],[\"Contributing\",\"https://github.com/invertase/react-native-firebase/blob/main/CONTRIBUTING.md\"],[\"AI Logic\",[[\"Usage\",\"/ai/usage\"]],\"//firebase.google.com/static/images/icons/firebase-ai-logic.svg\"],[\"Analytics\",[[\"Usage\",\"/analytics/usage\"],[\"Screen Tracking\",\"/analytics/screen-tracking\"],[\"Building an Analytics Funnel\",\"https://blog.theodo.com/2018/01/building-google-analytics-funnel-firebase-react-native\"]],\"//firebase.google.com/static/images/products/icons/run_analytics.svg\"],[\"App Check\",[[\"Usage\",\"/app-check/usage\"]],\"//firebase.google.com/static/images/products/icons/build_app_check.svg\"],[\"App Distribution\",[[\"Usage\",\"/app-distribution/usage\"]],\"//firebase.google.com/static/images/products/icons/run_app_distribution.svg\"],[\"Authentication\",[[\"Usage\",\"/auth/usage\"],[\"Social Auth\",\"/auth/social-auth\"],[\"Phone Auth\",\"/auth/phone-auth\"],[\"OpenID Connect Auth\",\"/auth/oidc-auth\"],[\"Multi-factor Auth\",\"/auth/multi-factor-auth\"]],\"//firebase.google.com/static/images/products/icons/build_auth.svg\"],[\"Cloud Firestore\",[[\"Usage\",\"/firestore/usage\"],[\"Usage with Emulator\",\"/firestore/emulator\"],[\"Usage with FlatLists\",\"/firestore/usage-with-flatlists\"],[\"Implementing Pagination\",\"/firestore/pagination\"],[\"Building a \\\"TODO\\\" app\",\"https://invertase.io/blog/getting-started-with-cloud-firestore-on-react-native\"]],\"//firebase.google.com/static/images/products/icons/build_firestore.svg\"],[\"Cloud Functions\",[[\"Usage\",\"/functions/usage\"],[\"Writing & Deploying Functions\",\"/functions/writing-deploying-functions\"]],\"//firebase.google.com/static/images/products/icons/build_functions.svg\"],[\"Cloud Messaging\",[[\"Usage\",\"/messaging/usage\"],[\"iOS Project Setup\",\"/messaging/usage/ios-setup\"],[\"iOS Permissions\",\"/messaging/ios-permissions\"],[\"Notifications\",\"/messaging/notifications\"],[\"iOS Notification Images\",\"/messaging/ios-notification-images\"],[\"Server Integration\",\"/messaging/server-integration\"]],\"//firebase.google.com/static/images/products/icons/run_cloud_messaging.svg\"],[\"Cloud Storage\",[[\"Usage\",\"/storage/usage\"]],\"//firebase.google.com/static/images/products/icons/build_storage.svg\"],[\"Core / App\",[[\"Usage\",\"/app/usage\"],[\"JSON Config\",\"/app/json-config\"],[\"Utils\",\"/app/utils\"]],\"//static.invertase.io/assets/social/firebase-logo.png\"],[\"Crashlytics\",[[\"Usage\",\"/crashlytics/usage\"],[\"Viewing crash reports\",\"/crashlytics/crash-reports\"]],\"//firebase.google.com/static/images/products/icons/run_crashlytics.svg\"],[\"Realtime Database\",[[\"Usage\",\"/database/usage\"],[\"Offline Support\",\"/database/offline-support\"],[\"Presence Detection\",\"/database/presence-detection\"]],\"//firebase.google.com/static/images/products/icons/build_realtime_database.svg\"],[\"In-App Messaging\",[[\"Usage\",\"/in-app-messaging/usage\"]],\"//firebase.google.com/static/images/products/icons/run_in_app_messaging.svg\"],[\"Installations\",[[\"Usage\",\"/installations/usage\"]],\"//static.invertase.io/assets/social/firebase-logo.png\"],[\"ML\",[[\"Usage\",\"/ml/usage\"]],\"//firebase.google.com/static/images/products/icons/build_ml.svg\"],[\"Remote Config\",[[\"Usage\",\"/remote-config/usage\"]],\"//firebase.google.com/static/images/products/icons/run_remote_config.svg\"],[\"Performance Monitoring\",[[\"Usage\",\"/perf/usage\"],[\"Axios Integration\",\"/perf/axios-integration\"],[\"KY Integration\",\"/perf/ky-integration\"]],\"//firebase.google.com/static/images/products/icons/run_performance.svg\"],[\"VertexAi\",[[\"Usage\",\"/vertexai/usage\"]],\"//static.invertase.io/assets/social/firebase-logo.png\"],[\"Legacy docs\",[[\"Migrating to v6\",\"/migrating-to-v6\"],[\"Legacy Docs (<= v5)\",\"https://v5.rnfirebase.io/docs/v5.x.x/getting-started\"]],\"//static.invertase.io/assets/social/firebase-logo.png\"]]"}},"pageContext":{"id":"4860e67e-05fb-55bf-a962-dd50baed8ab1","next":"/messaging/ios-permissions","previous":"/messaging/usage"}},"staticQueryHashes":["3688227230"]}