Skip to content

Commit 10961f2

Browse files
abdulraqeeb33AR Abdul Azeez
andauthored
chore: getting started doc for iOS (#1652)
* getting started doc for iOS * added more screenshots --------- Co-authored-by: AR Abdul Azeez <abdul@onesignal.com>
1 parent 4c43395 commit 10961f2

5 files changed

Lines changed: 101 additions & 0 deletions

File tree

GettingStarted.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Getting Started with the Red App
2+
3+
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.
4+
5+
<p align="center">
6+
<img src="docs/assets/red-app-screenshot.png" alt="Red App screenshot" width="300"/>
7+
</p>
8+
9+
## Prerequisites
10+
11+
| Requirement | Minimum Version |
12+
|-------------|-----------------|
13+
| macOS | 13 Ventura+ |
14+
| Xcode | 15.0+ |
15+
| Swift | 5.9+ |
16+
| iOS target | 16.0+ |
17+
18+
## Running the App
19+
20+
### Option A — Open via the workspace (recommended)
21+
22+
1. Open `iOS_SDK/OneSignalSDK.xcworkspace` in Xcode.
23+
2. In the scheme selector (top-left toolbar), choose **OneSignalSwiftUIExample**.
24+
3. Pick a simulator (e.g. iPhone 17 Pro) or a connected device.
25+
4. Press **Cmd + R** to build and run.
26+
27+
Your Xcode toolbar should look like this — scheme set to **OneSignalSwiftUIExample**, a simulator chosen, and the app running:
28+
29+
<p align="center">
30+
<img src="docs/assets/xcode-run-button.png" alt="Xcode toolbar showing the app running" width="700"/>
31+
</p>
32+
33+
The workspace contains multiple schemes. Make sure **OneSignalSwiftUIExample** is selected:
34+
35+
<p align="center">
36+
<img src="docs/assets/xcode-scheme-selector.png" alt="Xcode scheme selector showing OneSignalSwiftUIExample" width="700"/>
37+
</p>
38+
39+
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:
40+
41+
<p align="center">
42+
<img src="docs/assets/xcode-console-output.png" alt="Xcode console showing SDK debug logs" width="700"/>
43+
</p>
44+
45+
### Option B — Open from the terminal
46+
47+
```bash
48+
open iOS_SDK/OneSignalSDK.xcworkspace
49+
```
50+
51+
Then follow steps 2–4 from Option A.
52+
53+
### Option C — Open only the example project
54+
55+
> Use this if you only need the sample app and don't plan to modify the SDK source.
56+
57+
```bash
58+
open iOS_SDK/OneSignalSwiftUIExample/OneSignalSwiftUIExample.xcodeproj
59+
```
60+
61+
Select the **OneSignalSwiftUIExample** scheme, pick a destination, and run.
62+
63+
> **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.
64+
65+
## Using Your Own App ID
66+
67+
The default App ID (`77e32082-ea27-...c72e141824ef`) is a shared test key. To use your own:
68+
69+
1. Open `iOS_SDK/OneSignalSwiftUIExample/OneSignalSwiftUIExample/Services/OneSignalService.swift`.
70+
2. Replace the `defaultAppId` value with your OneSignal App ID (available at [onesignal.com](https://onesignal.com)).
71+
72+
## Features
73+
74+
The Red App is organized into scrollable sections, each mapping to a OneSignal SDK capability:
75+
76+
| Section | What It Does |
77+
|---------|-------------|
78+
| **Logs** | Collapsible live SDK log viewer with a configurable entry limit and clear button. |
79+
| **App Info** | Displays the current App ID and a consent-required toggle that gates SDK data processing. |
80+
| **User** | Shows login status (Anonymous / Identified) and External ID. Login and logout buttons to switch between user states. |
81+
| **Push** | Displays the Push Subscription ID, an enable/disable toggle, and permission status. |
82+
| **Send Push Notification** | Quick-fire buttons (Simple, Custom) to send test push notifications to the current device. |
83+
| **In-App Messaging** | Pause/resume in-app messages. |
84+
| **Send In-App Message** | Trigger a test in-app message. |
85+
| **Aliases** | Add and remove key-value aliases for the current user. |
86+
| **Email** | Add and remove email subscriptions. |
87+
| **SMS** | Add and remove SMS subscriptions. |
88+
| **Tags** | Manage user tags used for audience segmentation. |
89+
| **Outcome Events** | Fire unique, regular, or valued outcome events for analytics. |
90+
| **Triggers** | Set and remove in-app message triggers. |
91+
| **Track Event** | Send custom user events with optional properties. |
92+
| **Location** | Toggle location sharing and request location permissions. |
93+
| **Live Activities** | Start and manage iOS Live Activities via OneSignal. |
94+
95+
## Troubleshooting
96+
97+
| Problem | Fix |
98+
|---------|-----|
99+
| Build fails with missing framework | Make sure you opened the **`.xcworkspace`**, not the `.xcodeproj`. |
100+
| 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. |
101+
| "Consent Required" blocks SDK calls | Toggle **Consent Required** off, or call the consent API to grant consent. |

docs/assets/red-app-screenshot.png

56 KB
Loading
38.7 KB
Loading

docs/assets/xcode-run-button.png

40.5 KB
Loading
46.9 KB
Loading

0 commit comments

Comments
 (0)