Open k2xl opened 1 year ago
i think, it is your xcode version, if you use xcode 15.2 or highest xcode. you can try after upgrade the mobile device's software(OS) version. Install software(OS) updates on the device.
I'm having the same issue here. @ademirtemur Could you please give more details? Not sure to understand your solution.
100% Fixed my issue by:
- setting FirebaseAppDelegateProxyEnabled to NO in Info.plist
- Go to AppDelegate.mm and add the following inside didFinishLaunchingWithOptions function: [application registerForRemoteNotifications];
- Go to didRegisterForRemoteNotificationsWithDeviceToken function and add this: [FIRMessaging messaging].APNSToken = deviceToken;
- Clean build and start build again.
(FYI, make sure to use real device for testing.)
Hope it works for you guys.
FYI: If you are using Firebase dynamic links for your project you can just switch the FirebaseAppDelegateProxyEnabled to YES as it causes issues with dynamic links.
This worked well.
Obrigado pelas respostas. Estou em um aplicativo gerenciado pela Expo, entĆ£o nĆ£o tinha um arquivo firebase.json...
Tentei adicionar um firebase.json na raiz da pasta e removi
await messaging().registerDeviceForRemoteMessages()
(pois estava mostrando que era desnecessƔrio).No entanto
await messaging().getToken();
trava... e ainda consigoThe operation couldnāt be completed. No APNS token specified before fetching FCM Token
TambƩm estou nesse mesmo cenƔrio
Hello š, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
I'm getting this error
Error: [messaging/unknown] The data couldnāt be read because it isnāt in the correct format.
on ios ( using sentry ).
not sure if it's related here ?
Not sure if this provides any insights. I've been working with language translation on my react native app and have found that whenever I change the preferred/set language of my iOS device and open my RN app, the messaging().getToken()
FCM token fetch fails with this error code:
[Error: [messaging/unknown] The operation couldnāt be completed. No APNS token specified before fetching FCM Token]
The issue tends to resolve itself by attempting to restart the app a few times. Are there any specifics to why this would occur? Does modifying device settings invalidate an APNS token? Very confused why switching from English -> Spanish would cause this reproducible bug so easily.
I closed the emulator, used "npx expo run:ios" again, and now it works. I think this will help.
After reading your comment, I immediately switched to React-native-bootsplash. Currently, I do not receive this error: "No APNS token specified before fetching FCM Token". Thank you.
I'm using the same package, but still this error happens
My issue was resolved by adding onRegister() inside PushNotification.configure(). I was not setting the retrieved APNS token in messaging() before asking for the FCM token.
onRegister(token) {
if (Platform.OS === 'ios') {
messaging().setAPNSToken(token.token);
}
}
If you're winding up on this thread, and have an Expo managed project, note that there's apparently an issue under Expo v51 where it removes a necessary entitlement, you can add it back in the app.config.ts
:
ios: {
entitlements: {
"aps-environment": "development",
},
See: https://github.com/invertase/react-native-firebase/issues/7825
For me, by changing below:
<key>FirebaseAppDelegateProxyEnabled</key>
<false/>
To:
<key>FirebaseAppDelegateProxyEnabled</key>
<true/>
Worked
For me what solved was adding both "react-native-push-notification" and "@react-native-community/push-notification-ios" packages. Then in my entry file (root/index.js) adding this:
// ... other code ...
import PushNotification from 'react-native-push-notification';
PushNotification.configure({
// Called when Token is generated (iOS and Android)
onRegister: function (token) {
console.log('TOKEN:', token);
if (Platform.OS === 'ios') {
messaging().setAPNSToken(token.token);
}
},
});
// ... other code...
AppRegistry.registerComponent(appName, () => App);
I also suddenly got this problem, and none of the solutions in this thread helped me (I'm running on iOS simulator), a quick Erase all content and settings... solved the issue for me. š¤·
I also suddenly got this problem, and none of the solutions in this thread helped me (I'm running on iOS simulator), a quick Erase all content and settings... solved the issue for me. š¤·
what version of firebase messaging & app are you using?
I solved by adding this code into AppDelegate.mm file. You can try this solution.
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { [FIRMessaging messaging].APNSToken = deviceToken; //add this line }
This work for me, thanks
I solved by adding this code into AppDelegate.mm file. You can try this solution.
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { [FIRMessaging messaging].APNSToken = deviceToken; //add this line }
This work for me, thanks
can you please tell me what version of firebase app & messaging are you using?
I solved by adding this code into AppDelegate.mm file. You can try this solution.
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { [FIRMessaging messaging].APNSToken = deviceToken; //add this line }
This work for me, thanks
can you please tell me what version of firebase app & messaging are you using?
"@react-native-firebase/app": "^20.1.0", "@react-native-firebase/messaging": "^20.1.0",
Issue
Trying to get token from user.
When running this on iOS simulator, I getA
on the console but it never reaches B. On further debugging just callingawait messaging()
seems to do enough to hang.I see now after adding initializeApp() with credentials from firebase the following error
Project Files
Javascript
Click To Expand
#### `package.json`: ```json "@react-native-firebase/app": "^17.0.0", "@react-native-firebase/messaging": "^17.0.0", ``` #### `firebase.json` for react-native-firebase v6: ```json # N/A ```
iOS
Click To Expand
#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby # N/A ``` #### `AppDelegate.m`: ```objc // N/A ```
Android
Click To Expand
#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [ ] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`: ```groovy // N/A ``` #### `android/app/build.gradle`: ```groovy // N/A ``` #### `android/settings.gradle`: ```groovy // N/A ``` #### `MainApplication.java`: ```java // N/A ``` #### `AndroidManifest.xml`: ```xml ```
Environment
Click To Expand
System: OS: macOS 12.5 CPU: (10) arm64 Apple M1 Pro Memory: 227.88 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 19.5.0 - /opt/homebrew/bin/node Yarn: Not Found npm: 9.3.1 - /opt/homebrew/bin/npm Watchman: Not Found Managers: CocoaPods: 1.11.3 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: Not Found IDEs: Android Studio: 2022.1 AI-221.6008.13.2211.9477386 Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 17.0.6 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.1.0 => 18.1.0 react-native: 0.70.5 => 0.70.5 react-native-macos: Not Found npmGlobalPackages: *react-native*: Not Found ``` OUTPUT GOES HERE ``` - **Platform that you're experiencing the issue on**: - [ ] iOS - [ ] Android - [x ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `"@react-native-firebase/app": "^17.0.0", - "@react-native-firebase/messaging": "^17.0.0",` - **`Firebase` module(s) you're using that has the issue:** - `e.g. Instance ID` - **Are you using `TypeScript`?** - `Y`
React Native Firebase
andInvertase
on Twitter for updates on the library.