Requirements
- iOS 13.4 or newer.
- A Sendrealm app ID from the dashboard.
- Push Notifications enabled for the Apple App ID.
- Push Notifications enabled on the Xcode target.
- APNs credentials uploaded in Sendrealm.
- A physical iOS device for end-to-end push testing.
sandbox for development builds installed from Xcode. Use production for TestFlight and App Store builds.
See Mobile Push Credentials for APNs setup.
Install With Swift Package Manager
In Xcode:- Open your project.
- Choose File, then Add Package Dependencies.
- Enter the Sendrealm iOS SDK repository URL.
- Add the
SendrealmIOSproduct to your app target.
Install With CocoaPods
Add the pod to yourPodfile:
.xcworkspace after installing pods.
Enable iOS Capabilities
In Xcode:- Open your app target.
- Open Signing & Capabilities.
- Add Push Notifications.
- Confirm the Team and Bundle Identifier match the app configured in Sendrealm.
Initialize
Configure and initialize during app startup:environment: "development" for test devices you want to target separately. Omit it for production.
Set apnsEnvironment based on the build:
Most apps should set
autoRequestPermission to false and ask for permission after explaining the value of notifications.
Register For Push
Add the standard app delegate callback so Sendrealm can complete iOS push registration:Ask For Permission
Ask for permission from a user action:Foreground Display
Configure foreground presentation when notifications should appear while the app is open:Link A Signed-In User
Calllogin after the user signs in:
logout when the user signs out.
Tags
Use tags for app-observed preferences, state, and behavior:Custom Events
Track app events for segmentation, analytics, or automations:Rich Notifications
Rich image notifications require a Notification Service Extension. In the extension target, call the Sendrealm helper:Silent Pushes
Silent pushes require Background Modes with Remote notifications enabled. Delivery is best effort and can be throttled by iOS. Do not rely on silent pushes as the only path for critical user-visible work.Diagnostics
Use diagnostics while testing:- A device ID.
- Token presence.
- Expected APNs environment.
- Expected permission status.
- Subscribed state unless the user opted out.
- No unexpected SDK error.