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:
| Build type | APNs environment |
|---|---|
| Xcode debug or development-signed build | sandbox |
| TestFlight | production |
| App Store | production |
| Production-signed ad hoc build | production |
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.
Troubleshooting
| Symptom | What to check |
|---|---|
| Token is missing | Test on a physical device and confirm Push Notifications are enabled in Apple Developer and Xcode. |
| Development push fails | Confirm apnsEnvironment is sandbox and the build is development-signed. |
| TestFlight or App Store push fails | Confirm apnsEnvironment is production. |
| Signing fails after enabling push | Refresh automatic signing or regenerate the provisioning profile. |
| Notifications are delayed | Check APNs priority, device connectivity, Focus settings, and notification settings. |
| Silent pushes are inconsistent | This is expected under iOS power policy; use silent pushes only for best-effort refresh work. |
| Rich images do not attach | Confirm the Notification Service Extension is included in the app build. |
Tags fail with ContactNotLinked | Call login(userId, email) before setting user tags. |