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

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. "Signing & Capabilities" > "All"
  3. Check that the "App Groups" matches group.YOUR_BUNDLE_IDENTIFIER.onesignal where YOUR_BUNDLE_IDENTIFIER is the same as set in "Bundle Identifier"
  4. In the OneSignalNotificationServiceExtension Target
  5. "Signing & Capabilities" > "All"
  6. Check that the "App Groups" matches group.YOUR_BUNDLE_IDENTIFIER.onesignal where YOUR_BUNDLE_IDENTIFIER is the same as set in the Main App Target's "Bundle Identifier". Not the OneSignalNotificationServiceExtension Bundle Identifier
  7. Press the "Refresh" button on each App Groups to make sure it is valid.

Entitlements Mismatch

Common setup issue with App Groups.

Your Entitlements file may not match your Capabilities selected in Xcode. Check your .entitlements file or 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.

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.

Common Setup Issues

Check your Provisioning Profiles are setup

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

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.

Send Notification With Badges

Set either "Increase" or "Set To" and enter a number under iOS Options when creating a new message. The badge icon number is cleared automatically when the app is resumed or opened. Setting the count to 0 with a notification will also clear the value.

For API notifications, you can set both ios_badgeType and ios_badgeCount parameters.

Updated about a month ago

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.