OneSignal Help & Documentation

Welcome to the OneSignal New IA developer hub. You'll find comprehensive guides and documentation to help you start working with OneSignal New IA as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    Discussions

iOS SDK App Groups setup

OneSignal iOS App Groups setup for Badges and Confirmed Deliveries

📘

Required for certain features

Setting up an App Group in Xcode is required to allow badge incrementing and Confirmed Deliveries.

1. Add Notification Service Extension

1. Follow our guide on Add Notification Service Extension if you haven't done so already.

2. Enable "App Groups" Capability

  1. In your Main App Target
  2. Go to "Signing & Capabilities" > "All"
  3. Click "+ Capability" if you do not have App Groups in your app yet.
  4. Select App Groups
  1. Under App Groups click the "+" button
  2. Set the "App Groups" container to be group.YOUR_BUNDLE_IDENTIFIER.onesignal where YOUR_BUNDLE_IDENTIFIER is the same as set in "Bundle Identifier"
  3. Press OK
  1. In the OneSignalNotificationServiceExtension Target
  2. Go to "Signing & Capabilities" > "All"
  3. Click "+ Capability" if you do not have App Groups in your app yet.
  4. Select App Groups
  1. Under App Groups click the "+" button
  2. Set the "App Groups" container to be group.YOUR_BUNDLE_IDENTIFIER.onesignal where YOUR_BUNDLE_IDENTIFIER is the same as your Main App Target "Bundle Identifier". Do Not Include OneSignalNotificationServiceExtension.
  3. Press OK

3. Setup OneSignal key in .plist

This step is only required if you don't want to use the default app group name (which is group.{your_bundle_id}.onesignal).

1. Open your Info.plist file and add a new OneSignal_app_groups_key as a String type.
2. Enter the group name you checked in the last step as it's value.
3. Make sure to do the same for the Info.plist under the OneSignalNotificationServiceExtension folder.

👍

Done!

That is all you should need to send iOS Push Notifications with Badges.

If you are sending push and notice the badge count is not incrementing correctly see below iOS App Groups Troubleshooting

iOS App Groups Troubleshooting

Deployment Target 10

Make sure your OneSignalNotificationServiceExtension has a Deployment Target of 10 (see step 1.5 in our setup guide if needed). iOS 10 is when the Notification Service Extension was created for adding Rich Media to your iOS Push Notifications.

Entitlements Match

Your Entitlements file may not match your Capabilities selected in Xcode. Check your .entitlements files: Entitlements-Release.plist file and Entitlements-debug.plist file to make sure you have App Groups enabled for each.

You can find entitlements file location from Xcode > Your Targets > Build Settings > then search Entitlements.

For example, if your .entitlements file or Entitlements-Release.plist and Entitlements-debug.plist do not contain App Groups, make sure to add them to both targets:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>aps-environment</key>
    <string>production</string>
    <key>com.apple.security.application-groups</key>
    <array>
      <string>group.YOUR_BUNDLE_IDENTIFIER.onesignal</string> <!--Fill your bundle id-->
    </array>
  </dict>
</plist>

Make sure these files are setup the same for the Main App Target and OneSignalNotificationServiceExtension Target.

More details see this github issue.

Check your Provisioning Profiles are setup

You may need to setup 2 Provisioning Profiles: for your main app target and for the OneSignal Notification Service Extension target.

See Step 5 of Generate an iOS Push Certificate.

Make sure the App Groups in both Provisioning Profiles (your main app target and Notification Service Extension Target) match in Apple Developer Account. You may need to download these files and import into Xcode.

For example, in your Xamarin iOS project, click on the main app target project and go to Options to see if the new provisioning profile appeared. Do the same for the NSE project and the provisioning profile of the NSE should appear. Both, in the Custom Entitlements should be filled with “Entitlements.plist”.

For publishing the app to the App Store, some needed to create two provisioning profiles (associated with the Distribution certificates); one for the main app and the other one for the NSE project.

Updated 3 months ago


What's Next

Badges

iOS SDK App Groups setup


OneSignal iOS App Groups setup for Badges and Confirmed Deliveries

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.