You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/build_ios.md
+28-31Lines changed: 28 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,40 +1,34 @@
1
-
# iOS Setup: Push Notifications + Live Activities
1
+
# iOS Setup (React Native): Push Notifications + Live Activities
2
2
3
-
Configure the demo Flutter iOS project (`com.onesignal.example`) for OneSignal push notifications and live activities. All paths below are relative to the `ios/`directory.
3
+
Configure the React Native demo iOS project for OneSignal push notifications and live activities. All paths below are relative to `examples/demo/ios/`unless stated otherwise.
4
4
5
5
---
6
6
7
7
## 1. Podfile
8
8
9
-
Open `ios/Podfile` and make the following changes.
9
+
Open `Podfile` and keep the main React Native target (`target 'demo' do ... end`) as-is.
10
10
11
-
**Uncomment the platform line** (or add it if missing):
12
-
13
-
```ruby
14
-
platform :ios, '13.0'
15
-
```
16
-
17
-
**Add two new targets** after the `Runner` target block and before `post_install`:
11
+
Add two extension targets after the `demo` target block:
18
12
19
13
```ruby
20
14
target 'OneSignalNotificationServiceExtension'do
21
-
use_frameworks!
15
+
use_frameworks!:linkage => :static
22
16
pod 'OneSignalXCFramework', '>= 5.0.0', '< 6.0'
23
17
end
24
18
25
19
target 'OneSignalWidgetExtension'do
26
-
use_frameworks!
20
+
use_frameworks!:linkage => :static
27
21
pod 'OneSignalXCFramework', '>= 5.0.0', '< 6.0'
28
22
end
29
23
```
30
24
31
25
---
32
26
33
-
## 2. Runner: entitlements + Info.plist
27
+
## 2. App target: entitlements + Info.plist
34
28
35
-
### Runner.entitlements
29
+
### `demo/demo.entitlements`
36
30
37
-
Create `Runner/Runner.entitlements`:
31
+
Create `demo/demo.entitlements`:
38
32
39
33
```xml
40
34
<?xml version="1.0" encoding="UTF-8"?>
@@ -55,7 +49,7 @@ This enables push notifications (`aps-environment`) and an App Group shared with
55
49
56
50
### Info.plist
57
51
58
-
In `Runner/Info.plist`, add the `UIBackgroundModes` array inside the top-level `<dict>`:
52
+
In `demo/Info.plist`, add `UIBackgroundModes` inside the top-level `<dict>`:
59
53
60
54
```xml
61
55
<key>UIBackgroundModes</key>
@@ -68,7 +62,7 @@ In `Runner/Info.plist`, add the `UIBackgroundModes` array inside the top-level `
68
62
69
63
## 3. Notification Service Extension
70
64
71
-
Allows OneSignal to process notifications before display (rich media, badges, etc). Create the `OneSignalNotificationServiceExtension/` folder with three files.
65
+
Allows OneSignal to process notifications before display (rich media, badges, attachments). Create the `OneSignalNotificationServiceExtension/` folder with three files.
72
66
73
67
### NotificationService.swift
74
68
@@ -138,7 +132,7 @@ All standard `CFBundle*` keys are required for the simulator to install the exte
The `project.pbxproj` needs native target entries for both extensions. These are complex (UUIDs, build phases, configuration lists) and are best done by opening the `.xcodeproj` in Xcode. The key requirements:
265
+
The `project.pbxproj` needs native target entries for both extensions. These are UUID-heavy and easiest to configure in Xcode (`demo.xcodeproj`). Key requirements:
272
266
273
-
**Runner target changes:**
274
-
- Add `CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements` to all Runner build configurations (Debug/Release/Profile)
275
-
- Add an `Embed Foundation Extensions` copy-files phase (`dstSubfolderSpec = 13`) embedding both `.appex` products. This phase must appear **before** the `Thin Binary` script phase to avoid a build cycle.
276
-
- Add target dependencies from Runner to both extension targets
267
+
**`demo` target changes:**
268
+
269
+
- Add `CODE_SIGN_ENTITLEMENTS = demo/demo.entitlements` to all app build configurations
270
+
- Add an `Embed Foundation Extensions` copy-files phase (`dstSubfolderSpec = 13`) embedding both `.appex` products
271
+
- Add target dependencies from `demo` to both extension targets
0 commit comments