Skip to content

Commit 45d057d

Browse files
committed
tweak ios build prompt
1 parent ee09c3c commit 45d057d

File tree

2 files changed

+34
-33
lines changed

2 files changed

+34
-33
lines changed

examples/build_ios.md

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,34 @@
1-
# iOS Setup: Push Notifications + Live Activities
1+
# iOS Setup (React Native): Push Notifications + Live Activities
22

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.
44

55
---
66

77
## 1. Podfile
88

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.
1010

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:
1812

1913
```ruby
2014
target 'OneSignalNotificationServiceExtension' do
21-
use_frameworks!
15+
use_frameworks! :linkage => :static
2216
pod 'OneSignalXCFramework', '>= 5.0.0', '< 6.0'
2317
end
2418

2519
target 'OneSignalWidgetExtension' do
26-
use_frameworks!
20+
use_frameworks! :linkage => :static
2721
pod 'OneSignalXCFramework', '>= 5.0.0', '< 6.0'
2822
end
2923
```
3024

3125
---
3226

33-
## 2. Runner: entitlements + Info.plist
27+
## 2. App target: entitlements + Info.plist
3428

35-
### Runner.entitlements
29+
### `demo/demo.entitlements`
3630

37-
Create `Runner/Runner.entitlements`:
31+
Create `demo/demo.entitlements`:
3832

3933
```xml
4034
<?xml version="1.0" encoding="UTF-8"?>
@@ -45,7 +39,7 @@ Create `Runner/Runner.entitlements`:
4539
<string>development</string>
4640
<key>com.apple.security.application-groups</key>
4741
<array>
48-
<string>group.com.onesignal.example.onesignal</string>
42+
<string>group.<YOUR_APP_GROUP_ID></string>
4943
</array>
5044
</dict>
5145
</plist>
@@ -55,7 +49,7 @@ This enables push notifications (`aps-environment`) and an App Group shared with
5549

5650
### Info.plist
5751

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>`:
5953

6054
```xml
6155
<key>UIBackgroundModes</key>
@@ -68,7 +62,7 @@ In `Runner/Info.plist`, add the `UIBackgroundModes` array inside the top-level `
6862

6963
## 3. Notification Service Extension
7064

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.
7266

7367
### NotificationService.swift
7468

@@ -138,7 +132,7 @@ All standard `CFBundle*` keys are required for the simulator to install the exte
138132

139133
### OneSignalNotificationServiceExtension.entitlements
140134

141-
The App Group must match the one in `Runner.entitlements`.
135+
The App Group must match the one in `demo/demo.entitlements`.
142136

143137
```xml
144138
<?xml version="1.0" encoding="UTF-8"?>
@@ -147,7 +141,7 @@ The App Group must match the one in `Runner.entitlements`.
147141
<dict>
148142
<key>com.apple.security.application-groups</key>
149143
<array>
150-
<string>group.com.onesignal.example.onesignal</string>
144+
<string>group.<YOUR_APP_GROUP_ID></string>
151145
</array>
152146
</dict>
153147
</plist>
@@ -266,39 +260,39 @@ struct OneSignalWidgetBundle: WidgetBundle {
266260

267261
---
268262

269-
## 5. project.pbxproj
263+
## 5. Xcode project settings (`demo.xcodeproj/project.pbxproj`)
270264

271-
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:
272266

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+
- Add `CODE_SIGN_ENTITLEMENTS = demo/demo.entitlements` to all app build configurations
269+
- Add an `Embed Foundation Extensions` copy-files phase (`dstSubfolderSpec = 13`) embedding both `.appex` products
270+
- Add target dependencies from `demo` to both extension targets
277271

278272
**OneSignalNotificationServiceExtension target** (`com.apple.product-type.app-extension`):
279273
- Sources, Frameworks, Resources build phases
280-
- `PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.OneSignalNotificationServiceExtension` (must be prefixed with parent app's bundle ID)
274+
- `PRODUCT_BUNDLE_IDENTIFIER = <APP_BUNDLE_ID>.OneSignalNotificationServiceExtension` (must be prefixed with the parent app bundle ID)
281275
- `CODE_SIGN_ENTITLEMENTS = OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements`
282276
- `INFOPLIST_FILE = OneSignalNotificationServiceExtension/Info.plist`
283277
- `SKIP_INSTALL = YES`, `SWIFT_VERSION = 5.0`, `IPHONEOS_DEPLOYMENT_TARGET = 13.0`
284278

285279
**OneSignalWidgetExtension target** (`com.apple.product-type.app-extension`):
286280
- Sources, Frameworks (linking WidgetKit.framework and SwiftUI.framework), Resources build phases
287-
- `PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.OneSignalWidgetExtension`
281+
- `PRODUCT_BUNDLE_IDENTIFIER = <APP_BUNDLE_ID>.OneSignalWidgetExtension`
288282
- `INFOPLIST_FILE = OneSignalWidget/Info.plist` (note: folder is `OneSignalWidget`, not `OneSignalWidgetExtension`)
289283
- `SKIP_INSTALL = YES`, `SWIFT_VERSION = 5.0`, `IPHONEOS_DEPLOYMENT_TARGET = 16.2` (Live Activities require iOS 16.2+)
290284

291285
---
292286

293287
## 6. Install dependencies
294288

295-
Run `flutter pub get` first (the Podfile reads `Generated.xcconfig` which this creates), then `pod install`:
289+
From `examples/demo/`, install JavaScript dependencies, then install iOS pods:
296290

297291
```sh
298-
flutter pub get
299-
cd ios && pod install
292+
bun install
293+
cd ios && bundle exec pod install
300294
```
301295

302-
This generates the Pods workspace, xcconfig files, and CocoaPods build phases (`[CP] Check Pods Manifest.lock`, `[CP] Embed Pods Frameworks`). Open the `.xcworkspace` file (not `.xcodeproj`) going forward.
296+
This generates the Pods workspace, xcconfig files, and CocoaPods build phases (`[CP] Check Pods Manifest.lock`, `[CP] Embed Pods Frameworks`). Open `demo.xcworkspace` (not `demo.xcodeproj`) going forward.
303297

304-
Note: avoid setting `CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER` in extension build configurations since CocoaPods provides it via xcconfig.
298+
Note: avoid setting `CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER` directly in extension build settings since CocoaPods provides it via xcconfig.

examples/demo/ios/demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)