How to add OneSignal to your iOS app
What OneSignal does for an iOS app
Apple delivers push through APNs, but APNs alone means managing tokens, certificates, and a sending server. OneSignal sits in front of that. It collects device tokens, manages subscriber lists and segments, and gives you a dashboard or REST API to send. You upload an APNs authentication key from your Apple developer account so OneSignal can deliver through Apple, and you enable the Push Notifications capability in your app. On the device, the SDK handles registration after the user grants permission, which iOS always requires for notifications.
Adding OneSignal with AppFlight
In AppFlight you open the integrations panel, choose OneSignal, and provide your App ID and, if you send programmatically, your REST API key. The App ID is stored as a client value and ships in the app. The REST API key is stored as a backend secret and stays server-side, never in the binary, because it can send to all your users. Sends can run as a Supabase edge function that holds the REST key. From there you can ask the AI to initialize OneSignal, prompt for permission, and wire a notification trigger, and it generates the SwiftUI.
A SwiftUI example
Initialize OneSignal at launch and request permission. The App ID is public:
import OneSignalFramework
import SwiftUI
@main
struct MyApp: App {
init() {
OneSignal.initialize("your-onesignal-app-id", withLaunchOptions: nil)
OneSignal.Notifications.requestPermission({ accepted in
print("Push permission granted: \(accepted)")
}, fallbackToSettings: true)
}
var body: some Scene {
WindowGroup { ContentView() }
}
}
Alternatives
Apple Push Notification service on its own is free and has no third party, but you build token storage, segmentation, and the sending server yourself. Firebase Cloud Messaging is a common free alternative that also wraps APNs and adds Google's tooling. OneSignal earns its place when you want segmentation, scheduling, A/B tested messages, and a ready dashboard without building a notification backend, while keeping the REST key safely server-side.
FAQ
Which OneSignal key goes in the iOS app?
The OneSignal App ID is a public identifier that is safe to ship in the binary. The REST API key, used to send notifications from a server, is a secret and must never ship in the app. AppFlight keeps the App ID client-side and the REST key server-side.
Do I still need an Apple push certificate?
You need an APNs authentication key from Apple, which you upload once to the OneSignal dashboard so it can deliver through Apple. You also enable the Push Notifications capability in your app. OneSignal then talks to APNs on your behalf.
Can I send notifications without a backend?
You can send manually from the OneSignal dashboard with no code. For automated or user-triggered sends you call the OneSignal REST API from a server using the secret REST key. With AppFlight that send can run as a Supabase edge function.