Skip to content

Commit 1b8df4c

Browse files
committed
feat(app, ios)!: adopt firebase-ios-sdk 10.4.0
BREAKING CHANGE: You must have an APNS token before calling getToken to get an FCM token on iOS. Previously it was not required. See documentation for setAPNSToken if you are using getToken in testing or have disabled FCM Swizzling, and use setAPNSToken to set a token before using getToken
1 parent 8d75b36 commit 1b8df4c

4 files changed

Lines changed: 124 additions & 118 deletions

File tree

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ Open your projects `/ios/Podfile` and add any of the globals shown below to the
232232

233233
```ruby
234234
# Override Firebase SDK Version
235-
$FirebaseSDKVersion = '10.3.0'
235+
$FirebaseSDKVersion = '10.4.0'
236236
```
237237

238238
Once changed, reinstall your projects pods via pod install and rebuild your project with `npx react-native run-ios`.

packages/app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
},
6666
"sdkVersions": {
6767
"ios": {
68-
"firebase": "10.3.0",
68+
"firebase": "10.4.0",
6969
"iosTarget": "11.0",
7070
"macosTarget": "10.13"
7171
},

packages/messaging/ios/RNFBMessaging/RNFBMessagingModule.m

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ - (NSDictionary *)constantsToExport {
114114
: (NSString *)senderId
115115
: (RCTPromiseResolveBlock)resolve
116116
: (RCTPromiseRejectBlock)reject) {
117-
// #if !(TARGET_IPHONE_SIMULATOR)
118117
if ([UIApplication sharedApplication].isRegisteredForRemoteNotifications == NO) {
119118
[RNFBSharedUtils
120119
rejectPromiseWithUserInfo:reject
@@ -126,7 +125,14 @@ - (NSDictionary *)constantsToExport {
126125
}];
127126
return;
128127
}
129-
// #endif
128+
129+
// As of firebase-ios-sdk 10.4.0, an APNS token is strictly required for getToken to work
130+
NSData *apnsToken = [FIRMessaging messaging].APNSToken;
131+
if (apnsToken == nil) {
132+
DLog(@"RNFBMessaging getToken - no APNS token is available. Firebase requires an APNS token to "
133+
@"vend an FCM token in firebase-ios-sdk 10.4.0 and higher. See documentation on "
134+
@"setAPNSToken and getAPNSToken.")
135+
}
130136

131137
[[FIRMessaging messaging]
132138
retrieveFCMTokenForSenderID:senderId

0 commit comments

Comments
 (0)