Early access · launching soon. Request access

Early access

Early access · launching soon
Product
IntelligenceEarly access. Designed and in development. No results yet. See what's left on the roadmap.
Developers
Resources
Request access

A person reads every request.

Developers · iOS SDK

iOS push notification SDK

A Swift Package for iOS 13 and later with no third-party dependencies. Your app keeps Firebase Messaging for the push token. Oricato registers the installation with your account, reports deliveries, opens and conversions, opens links, and can add images through a Notification Service Extension.

OricatoPushOricatoPushNotificationServiceiOS 13+Xcode 15+ (Swift 5.9)

Last updated · Ask the docs, or a person

What the iOS SDK does with one push Sample data. Illustrative numbers, not from a real app.
Hands holding a phone on a Tokyo commuter train in the morning, the city skyline through the window
7:00AM · Tokyo 日本語

Lingora 今

今日のレッスンの準備ができました

5分で12日連続の記録をキープできます。

receiptsiOS

  1. pushfx_id 0192f0c4… · fx_v 107:00:00
  2. shownservice extension · image07:00:01
  3. deliveredsampled device · once07:00:03
  4. openedtap · launch_url lingora://lesson07:00:41

A photo of a phone in someone's hands; on its screen, a sample notification from Lingora in the language ja. Beside it, the receipts the SDK reports for that push: shown, delivered from a sampled device, and opened on tap.

01

Requirements

  • Xcode 15 or newer, iOS 13 or later.
  • Firebase Messaging set up in the app, with your APNs key uploaded in the Firebase console under Project settings › Cloud Messaging.
  • The Push Notifications capability. Background Modes › Remote notifications is recommended by Firebase.
ProductAdd it toContains
OricatoPushthe app targetOricato: initialize, the FCM token, tags, handlers, permission, delegate helpers.
OricatoPushNotificationServicethe Notification Service Extension target (optional)OricatoNotificationService and a helper class.

02

Add the package

During early access the package comes in the SDK kit we hand over with your account. Copy the OricatoPush folder into your repository so the app builds on any machine, then add it in Xcode with File › Add Package Dependencies › Add Local, and add the product OricatoPush to your app target.

03

Initialize and pass the FCM token

Set everything up in didFinishLaunchingWithOptions, including the notification center delegate, so the tap that launched the app reaches Oricato. Let Oricato handle its own notifications first and fall through to yours.

Swift

AppDelegate.swiftUntested

import UIKit
import FirebaseCore
import FirebaseMessaging
import OricatoPush

@main
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate, MessagingDelegate {

    func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {
        FirebaseApp.configure()
        Messaging.messaging().delegate = self

        Oricato.initialize(projectId: "<ORICATO_PROJECT_ID>", apiBaseURL: "<ORICATO_API_ADDRESS>")

        UNUserNotificationCenter.current().delegate = self
        Oricato.onNotificationOpened { notification in
            // notification.messageId, .title, .body, .launchUrl, .additionalData
        }
        Oricato.requestPermission() // or later, at a better moment in onboarding
        application.registerForRemoteNotifications()
        return true
    }

    // Firebase → Oricato: at every start and whenever the FCM token changes.
    func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
        Oricato.setFCMToken(fcmToken)
    }

    func userNotificationCenter(
        _ center: UNUserNotificationCenter,
        willPresent notification: UNNotification,
        withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void
    ) {
        if Oricato.userNotificationCenter(center, willPresent: notification, withCompletionHandler: completionHandler) {
            return
        }
        completionHandler([.banner, .list, .sound]) // your other notifications
    }

    func userNotificationCenter(
        _ center: UNUserNotificationCenter,
        didReceive response: UNNotificationResponse,
        withCompletionHandler completionHandler: @escaping () -> Void
    ) {
        if Oricato.userNotificationCenter(center, didReceive: response, withCompletionHandler: completionHandler) {
            return
        }
        completionHandler() // your other notifications
    }
}
  • No delegate of your own? Skip the two methods and call Oricato.installNotificationCenterDelegate() after initialize. It handles Oricato notifications and forwards everything else to whichever delegate was set before.
  • SwiftUI: use @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate in your App.
  • Swift 6 language mode: declare the conformance as @preconcurrency UNUserNotificationCenterDelegate (a UIKit requirement).
  • The SDK reports the language your app shows (Bundle.main.preferredLocalizations). If people switch language inside the app, call Oricato.setLanguage("de"), or nil to follow the app's localization again.
  • Using Firebase with method swizzling off? Also pass the APNs token: Messaging.messaging().apnsToken = deviceToken.
  • http:// addresses work only in Debug builds or for localhost.

04

Notification Service Extension: images and delivery receipts

Without an extension, Oricato counts opens for every notification but deliveries only for those that arrive while the app is in the foreground, and images don't show. With the extension, every sampled device reports delivered and every notification shows its image. It needs no App Group and no shared storage: it reads what it needs from the push itself.

  1. In Xcode, File › New › Target › Notification Service Extension. Name it, for example, NotificationService, with a deployment target of iOS 13 or later.
  2. In the new target's General › Frameworks and Libraries, add OricatoPushNotificationService.
  3. Replace the generated file:
    Swift

    Untested

    import OricatoPushNotificationService
    
    class NotificationService: OricatoNotificationService {}
  4. In the extension's Info.plist, add OricatoApiBaseURL (String) set to your API address.
  5. In the app, after initialize, tell the SDK the extension reports deliveries, so they aren't counted twice:
    Swift

    Untested

    Oricato.setDeliveryReportedByExtension(true)

Oricato always sends mutable-content: 1, so iOS runs the extension for every Oricato push. The extension starts the receipt and downloads the image at the same time: HTTPS only, up to 10 MB, within 15 seconds. If iOS ends the time budget early, the text notification still shows. Pushes that aren't Oricato's pass through unchanged.

Badge "increase" is the one feature that needs an App Group, for a shared counter. Without one, use "set badge" in the composer.

Fig. 01What the extension does

APNs push mutable-content: 1

NotificationService OricatoNotificationService

receipt

delivered (if fx_dr = "1")

8 s timeout · one retry

image

download fx_image

https · ≤ 10 MB · 15 s

time budget ended

text-only notification

notification shown with image

An APNs push with mutable-content 1 reaches NotificationService, a subclass of OricatoNotificationService. Two lanes run in parallel: the delivered receipt (if fx_dr is 1, with an 8 second timeout and one retry) and the image download (fx_image, HTTPS only, up to 10 MB, within 15 seconds). Both join at the notification shown with its image. If the time budget ends, a dashed fallback shows the text-only notification.

05

Running next to OneSignal

Both SDKs can live in the same app while you move people over. Each push belongs to exactly one system: Oricato pushes carry fx_id and fx_v, OneSignal pushes carry custom.

  • Delegate. Keep your existing delegate and put the two Oricato.userNotificationCenter calls at the top of its methods. If OneSignal owns the delegate and you have none, call Oricato.installNotificationCenterDelegate() after OneSignal.initialize(…).
  • Token. OneSignal registers with Apple directly; Oricato uses the FCM token. Both work with the same APNs registration. If your app only had OneSignal, add Firebase Messaging first.
  • Extension. One extension can serve both. Subclass OricatoNotificationService and route other pushes to OneSignal in didReceiveOtherNotification, or keep your extension class and hand Oricato pushes to OricatoNotificationServiceHelper.
  • Audiences. Never send the same campaign from both systems to the same people.

Helper variant

Swift

NotificationService.swiftUntested

private var oricato: OricatoNotificationServiceHelper?

override func didReceive(_ request: UNNotificationRequest,
                         withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
    let helper = OricatoNotificationServiceHelper() // reads OricatoApiBaseURL from Info.plist
    if helper.didReceive(request, withContentHandler: contentHandler) { oricato = helper; return }
    // the existing OneSignal code
}

override func serviceExtensionTimeWillExpire() {
    if oricato?.serviceExtensionTimeWillExpire() == true { return }
    // the existing OneSignal code
}

The full migration reference

06

API

CallWhat it does
Oricato.initialize(projectId:apiBaseURL:)Safe on every launch. Loads the subscription ID, starts lifecycle observation, registers the installation.
Oricato.setFCMToken(_:)The token from Firebase Messaging; nil clears it.
Oricato.setLanguage(_:)The language your app shows, normalized (zh_TW becomes zh-hant); nil follows the app localization.
Oricato.setExternalUserId(_:hash:)Your opaque, pseudonymous user ID. hash comes from your backend when the project verifies IDs.
Oricato.setTags(_:)Merges tags, for example ["level": "b1"]; a nil or empty value removes a key. Up to 50 tags.
Oricato.optIn() / Oricato.optOut()App-level switch for receiving pushes.
Oricato.trackEvent(_:)A conversion such as lesson_completed. The server links it to a recent open.
Oricato.onNotificationOpened(_:)Tap handler, on the main thread.
Oricato.onForegroundNotification(_:)Foreground handler; return false to hide it.
Oricato.setForegroundPresentationOptions(_:)How shown foreground notifications look.
Oricato.requestPermission(options:completion:)Asks for permission and registers for remote notifications when granted.
Oricato.getPermissionStatus(_:)granted, denied, notDetermined or provisional.
Oricato.setLaunchUrlsAutoOpen(_:)Whether a tap opens the link by itself (default true, once per tap).
Oricato.setAppCheckTokenProvider(_:)Firebase App Check tokens.
Oricato.setDeliveryReportedByExtension(_:)true when the extension is installed.
Oricato.setAppGroup(_:)App Group, only for badge increase.
Oricato.subscriptionIdThis installation's ID.
Oricato.setLogLevel(_:)From .none to .verbose; .warn by default.
Oricato.installNotificationCenterDelegate()The automatic delegate proxy.
Oricato.isOricatoNotification(_:)True for an Oricato userInfo.

07

Firebase App Check

When your project's App Check mode is monitor or enforce, pass tokens. The SDK doesn't link App Check itself. Tokens are cached until five minutes before they expire.

Swift

Untested

import FirebaseAppCheck

Oricato.setAppCheckTokenProvider { forcingRefresh, completion in
    AppCheck.appCheck().token(forcingRefresh: forcingRefresh) { token, _ in completion(token?.token) }
}

08

What the SDK does on its own

  • Registers at launch and when the app becomes active if anything changed or the last success is more than an hour old, and right after any setter. It sends the FCM token, the Firebase project it reads from GoogleService-Info.plist, permission, language, time zone, a country hint, device model, iOS, app and SDK versions, your user ID and tags.
  • Notices permission changes whenever the app or one of its scenes becomes active, including the moment a permission alert closes and the return from Settings, so a grant from any prompt is reported at once.
  • Reports receipts once: opened for every tap, delivered for devices in your project's sample, each at most once per message.
  • Queues and retries: up to 500 events for up to 30 days, sent in batches of up to 100, with exponential backoff, jitter and Retry-After, including a background task when the app leaves the foreground.
  • Stores state in Application Support, excluded from backups and written atomically. Not UserDefaults, not the Keychain. A reinstall, or data restored onto another device, gets a new subscription ID.
  • Respects privacy: ships a privacy manifest with no tracking, and never sends the device name, the advertising ID or location.

09

Troubleshooting

  • Turn on logs with Oricato.setLogLevel(.debug) and filter Console by the subsystem com.oricato.push.
  • "Wrong Project ID": the Project ID or API address passed to initialize is wrong (HTTP 404). The SDK stops calling until the next launch.
  • No images: the extension is missing, OricatoApiBaseURL or the image URL isn't HTTPS, or the image is larger than 10 MB.
  • Flutter app and "Cycle inside Runner"? Move Runner's Embed Foundation Extensions build phase above Run Script and Thin Binary.

Oricato Intelligence · Early access

One more release, later

Designed and in development. No results yet.

Oricato Intelligence (early access) will need a later SDK version that counts app opens a notification did not start, inside the registration you already send, plus a consent switch your app sets. In the EEA and the UK it stays off until your app asks.

How Intelligence works

Early access · launching soon

Try it on your own iPhone.

Request access and we'll set up your dedicated account and hand you the SDK kit. Founding teams get early access and a founding discount. If OneSignal owns your notification delegate today, we'll help you move it, free.

We use this to reply, plan your invitation and set up your account. Privacy Policy

A person reads every request.

Or get the monthly newsletter