You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The **Red App** is a SwiftUI sample application that exercises every major feature of the OneSignal iOS SDK. Use it to validate SDK behavior, test integrations, and explore the API surface on a simulator or physical device.
3
+
This repo ships two ways to exercise the OneSignal iOS SDK:
|**OneSignalDevApp**|`iOS_SDK/OneSignalDevApp/`| Internal dev/test app wired into `OneSignalSDK.xcworkspace`. Builds against **local SDK source**, so any changes you make to the SDK are picked up immediately. Use this when modifying the SDK. |
8
+
|**examples/demo**|`examples/demo/`| Customer-facing SwiftUI demo that mirrors the OneSignal Capacitor / Cordova / RN demos (same section layout, accessibility identifiers, sdk-shared tooltip content). Builds against the published SwiftPM SDK. Use this as a reference integration. |
8
9
9
10
## Prerequisites
10
11
@@ -15,86 +16,42 @@ The **Red App** is a SwiftUI sample application that exercises every major featu
15
16
| Swift | 5.9+ |
16
17
| iOS target | 16.0+ |
17
18
18
-
## Running the App
19
+
## Running OneSignalDevApp (SDK contributors)
19
20
20
-
### Option A — Open via the workspace (recommended)
21
+
This is the recommended path when you're working on the SDK itself.
1. Open `iOS_SDK/OneSignalSDK.xcworkspace` in Xcode.
27
-
2. In the scheme selector (top-left toolbar), choose **OneSignalSwiftUIExample**.
28
-
3. Pick a simulator (e.g. iPhone 17 Pro) or a connected device.
23
+
1. Open `iOS_SDK/OneSignalSDK.xcworkspace` in Xcode (the workspace, not any individual `.xcodeproj`).
24
+
2. Select the **OneSignalDevApp** scheme.
25
+
3. Pick a simulator or a connected device.
29
26
4. Press **Cmd + R** to build and run.
30
27
31
-
Your Xcode toolbar should look like this above — scheme set to **OneSignalSwiftUIExample**, a simulator or physical device chosen, and the app running.
32
-
33
-
The workspace contains multiple schemes. Make sure **OneSignalSwiftUIExample** is selected.
34
-
35
-
Once the app is running, SDK debug logs stream to the Xcode console — useful for verifying network calls, subscription state, and in-app message events:
> Use this if you only need the sample app and don't plan to modify the SDK source.
52
-
53
-
```bash
54
-
open iOS_SDK/OneSignalSwiftUIExample/OneSignalSwiftUIExample.xcodeproj
55
-
```
28
+
SDK debug logs stream to the Xcode console — useful for verifying network calls, subscription state, and in-app message events.
56
29
57
-
Select the **OneSignalSwiftUIExample**scheme, pick a destination, and run.
30
+
> Push notification delivery requires a **physical device**with a valid APNs configuration. The simulator supports permission prompts and token generation but won't receive remote pushes.
58
31
59
-
> **Note:** Opening the `.xcworkspace` (Options A/B) is preferred because it links the sample app against the SDK source, so any local SDK changes are picked up automatically.
32
+
## Running examples/demo (reference integration)
60
33
61
-
## Using Your Own App ID
34
+
The `examples/demo/` app demonstrates the recommended integration shape for app developers, including a Notification Service Extension target and a Live Activities Widget Extension target.
62
35
63
-
The default App ID (`77e32082-ea27-...c72e141824ef`) is a shared test key. To use your own:
36
+
See [`examples/demo/README.md`](examples/demo/README.md) for full setup steps. In short:
64
37
65
-
**Changing the App ID requires uninstalling and reinstalling the app for it to take effect.**
38
+
1. Create the Xcode project at `examples/demo/App.xcodeproj` (the source files and extension folders are checked in but `project.pbxproj` is not).
39
+
2. Add the OneSignal SwiftPM dependency (`https://github.com/OneSignal/OneSignal-iOS-SDK`, 5.0.0+) and attach the right products to each of the three targets (App / NSE / Widget).
1. Open `iOS_SDK/OneSignalSwiftUIExample/OneSignalSwiftUIExample/Services/OneSignalService.swift`.
68
-
2. Replace the `defaultAppId` value with your OneSignal App ID (available at [onesignal.com](https://onesignal.com)).
69
-
3. Then uninstall the app from the device/simulator and run it again.
42
+
## Using your own App ID
70
43
71
-
## Features
44
+
Both apps default to a shared OneSignal App ID. To switch to your own:
72
45
73
-
The Red App is organized into scrollable sections, each mapping to a OneSignal SDK capability:
46
+
-**OneSignalDevApp** — open `iOS_SDK/OneSignalDevApp/OneSignalDevApp/AppDelegate.m` and replace the App ID passed to `OneSignal.initialize`.
47
+
-**examples/demo** — edit `examples/demo/App/Services/OneSignalService.swift` and replace `defaultAppId`, or override at runtime via `UserDefaults` (key `OneSignalAppId`).
74
48
75
-
| Section | What It Does |
76
-
|---------|-------------|
77
-
|**Logs**| Collapsible live SDK log viewer with a configurable entry limit and clear button. |
78
-
|**App Info**| Displays the current App ID and a consent-required toggle that gates SDK data processing. |
79
-
|**User**| Shows login status (Anonymous / Identified) and External ID. Login and logout buttons to switch between user states. |
80
-
|**Push**| Displays the Push Subscription ID, an enable/disable toggle, and permission status. |
81
-
|**Send Push Notification**| Quick-fire buttons (Simple, Custom) to send test push notifications to the current device. |
|**Send In-App Message**| Trigger a test in-app message. |
84
-
|**Aliases**| Add and remove key-value aliases for the current user. |
85
-
|**Email**| Add and remove email subscriptions. |
86
-
|**SMS**| Add and remove SMS subscriptions. |
87
-
|**Tags**| Manage user tags used for audience segmentation. |
88
-
|**Outcome Events**| Fire unique, regular, or valued outcome events for analytics. |
89
-
|**Triggers**| Set and remove in-app message triggers. |
90
-
|**Track Event**| Send custom user events with optional properties. |
91
-
|**Location**| Toggle location sharing and request location permissions. |
92
-
|**Live Activities**| Start and manage iOS Live Activities via OneSignal. |
49
+
Changing the App ID requires uninstalling and reinstalling the app for it to take effect.
93
50
94
51
## Troubleshooting
95
52
96
53
| Problem | Fix |
97
54
|---------|-----|
98
-
| Build fails with missing framework |Make sure you opened the **`.xcworkspace`**, not the`.xcodeproj`. |
99
-
| Push notifications don't arrive on simulator | Push delivery requires a **physical device** with a valid APNs configuration. The simulator supports permission prompts and token generation but won't receive remote pushes. |
100
-
| "Consent Required" blocks SDK calls | Toggle **Consent Required** off, or call the consent API to grant consent. |
55
+
| Build fails with missing framework |Open the workspace (`OneSignalSDK.xcworkspace`), not an individual`.xcodeproj`. |
56
+
| Push notifications don't arrive on simulator | Push delivery requires a physical device with APNs configured. |
57
+
| "Consent Required" blocks SDK calls | Toggle **Consent Required** off, or grant consent via the SDK's consent API. |
0 commit comments