DRDifferent Requests
Push notifications

Push notifications

Upload your push key so users get a push notification when a request they follow changes.

Push notifications are a Pro feature. A user who follows a request gets one when the request changes. Apple only accepts push notifications signed by your Apple team, so Different Requests sends them with your push key.

Upload your push key

  1. In your Apple Developer account, open Certificates, Identifiers & Profiles, then Keys.
  2. Create a key with Apple Push Notifications enabled.
  3. Download the .p8 file. Apple lets you download it once.
  4. Open the app's Push page in the dashboard.
  5. Upload the file with its Key ID, your Team ID and your bundle ID.
The Push page is in the dashboard, once you have an account.Start free

The push key is stored encrypted and never shown again. Unlike the API key, it is a secret: it signs push notifications for every app on your Apple team until you revoke it.

Register the device on every launch

A device token changes on reinstall, and Apple can invalidate one without notice. Register it at every launch, not once.

func application(
  _ application: UIApplication,
  didRegisterForRemoteNotificationsWithDeviceToken tokenData: Data
) {
  Task {
    do {
      let registered = try await requests.client.registerDevice(
        tokenData: tokenData,
        environment: .production
      )
      logger.info("DifferentRequests: device \(registered.device.id)")
    } catch {
      logger.error("DifferentRequests: \(error.localizedDescription)")
    }
  }
}

Pass the environment yourself. A token from a debug build is a sandbox token, and sending to a sandbox token in production fails without a useful error. Use .sandbox in debug builds and .production in what you ship.

Unregister the device at sign-out

unregisterDevice(deviceID:) removes a device. Call it when a user signs out of your app.

What a failed push notification does

Your code never sees an error. If a push notification can't be delivered, the user still sees the change in their inbox.