RNFirebaseMessaging in AppDelegate.o Symbol not found - ios

Environment:
Target Platform:
iOS (iOS 11.3 - iPhone 8)
Development Operating System:
macOS Sierra
Build tools: Xcode
"react-native": "0.53.3",
"react-native-firebase": "^3.3.1",
I already done and redone react-native link react-native-firebase and unlink.
I deleted the derived data folder several times.
clean, and restart xcode several times.
I also uninstall react-native-firebase.
Note :
when I import
import "RNFirebaseMessaging.h"
I have no problem.
it is when I use the following functions that build failed :
-(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
[RNFirebaseMessaging didReceiveLocalNotification:notification];
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo {
[RNFirebaseMessaging didReceiveRemoteNotification:userInfo];
}

Related

React Native 'GoogleMaps/GoogleMaps.h' file not found in AppDelegate.m:

Environment info
"react": "17.0.2",
"react-native": "0.66.3"
"react-native-maps": "^0.29.4"
XCode Version 13.1 (13A1030d)
macOS 12.0.1
Target Platform iOS 15.1 Phone using GoogleMaps
Steps to reproduce
Create new project
Add config = use_native_modules! in the Podfile
Add in the Podfile:
react-native-maps dependencies
rn_maps_path = '../node_modules/react-native-maps'
pod 'react-native-google-maps', :path => rn_maps_path
pod 'GoogleMaps'
pod 'Google-Maps-iOS-Utils'
pod install
Add in AppDelegate.m:
#import "AppDelegate.h"
#import <GoogleMaps/GoogleMaps.h>
#import <GooglePlaces/GooglePlaces.h>
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary
*)launchOptions
{
[GMSServices provideAPIKey:#"xxxx"];
[GMSPlacesClient provideAPIKey:#"xxxx"];
}
Build in XCode
Describe what you expected to happen:
Build successful
Describe what you actually happens:
/ios/UbiWalkerReactNat/AppDelegate.m:2:9: 'GoogleMaps/GoogleMaps.h' file not found
you need to first import import <GoogleMaps/GoogleMaps.h> in AppDelegate.m see here.
Seems to be solved, there was a WARNING on pod install:
[!] The xxx [Debug] target overrides the FRAMEWORK_SEARCH_PATHS build setting defined in Pods/Target Support Files/Pods-xxx-xxx/Pods-xxx-xxx.debug.xcconfig'. This can lead to problems with the CocoaPods installation - Use the $(inherited)` flag, or
Remove the build settings from the target.
I've SOLVED with $(inherited) flag on Build Settings.

Use of undeclared identifier 'Intercom' in AppDelegate.m - react-native-intercom

I am using react-native-intercom to manage Intercom in my app. I have installed the Intercom iOS SDK using CocoaPods, and linked the react-native-intercom. But Build failed with error Use of undeclared identifier 'Intercom' in AppDelegate.m - react-native-intercom
steps 1 (Install and Link Intercom)
npm install react-native-intercom
react-native link react-native-intercom
step 2 (Import Intercom in AppDelegate.m)
#import "Intercom/intercom.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[Intercom setApiKey:#"myApiKey" forAppId:#"myAppId"];
[Intercom registerUnidentifiedUser];
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
[Intercom setDeviceToken:deviceToken];
}
I am using react-native and fixed this issue by changing intercom into Intercom.
#import "Intercom/Intercom.h"
use #import "Intercom/Intercom.h" instead of #import "Intercom/intercom.h" in AppDelegate.m file
If you go into the framework's Headers folder in your workspace (Workspace -> Intercom.framework -> Headers) you will see the Intercom.h file.

Is there a work around for the conflict with the cordova-plugin-fcm-with-dependecy-updated and cordova ios

Im creating an Ionic 6.0 Cordova 9.0 project and I'm attempting to add the cordova fcm plugin in addition to the Cordova iOS 5.1.1 but it's failing in the build.
Here is my package json
"cordova": "^8.0.0",
"cordova-android-support-gradle-release": "^3.0.1",
"cordova-ios": "^5.1.1",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-fcm-with-dependecy-updated": "^7.3.0",
what's odd is Cordova says 8.0.0 which is really
cordova -v
9.0.0 (cordova-lib#9.0.1)
But the real problem is attempting to build the iOS project
** BUILD FAILED **
The following build commands failed:
CompileC /var/root/Library/Developer/Xcode/DerivedData/-fzuncmihunbgyyfsixovlktiuyaf/Build/Intermediates.noindex/app.build/Debug-iphonesimulator/app\ Mingle.build/Objects-normal/x86_64/AppDelegate+FCMPlugin.o /Users/anonymous/project/app-v5/platforms/ios/Heathen\ Mingle/Plugins/cordova-plugin-fcm-with-dependecy-updated/AppDelegate+FCMPlugin.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
and then when I attempt to open in xCode I get a similar error in this specific line of code:
- (void)messaging:(nonnull FIRMessaging *)messaging didReceiveRegistrationToken:(nonnull NSString *)deviceToken {
NSLog(#"Device FCM Token: %#", deviceToken);
if(deviceToken == nil) {
fcmToken = nil;
[FCMPlugin.fcmPlugin notifyFCMTokenRefresh:nil];
return;
}
Nullability specifier 'nonnull' conflicts with existing specifier 'nullable'
I don't have an issue with Android, only with iOS and this conflict.
EDIT: As a hot fix, you can delete "nonnull" keyword in the "- (void)messaging:(nonnull FIRMessaging *)messaging didReceiveRegistrationToken:(nonnull NSString *)deviceToken {" error statement. This helped me succeed in building the app.
I followed these steps for a successful build:
cd platforms/ios
pod repo update
pod install
cd ..
cd ..
Now Delete plugins folder, platforms folder and the node_modules folder. (Step 6, 7 and 8)
npm i
ionic cordova platform add ios
ionic cordova build ios
( I know I couldve just said I updated pod repo and re installed node modules, plugins and platform but alot of new devs might have wasted some more time figuring out these commands, so yeah! )

Linking.openURL(url) is not working on iOS (Trying to open Whatsapp)

For some reason, the linking feature to open a whatsapp contact is not working on iOS (it works perfect on Android), i followed the guide on this url for the setup https://reactnative.dev/docs/linking but always when i try to push the button that calls to whatsapp app to write a message directly, the app says something like:
Could not open this link, please review it and try again
The button in my screen app is this
openWhatsappUrl = () => {
const url = 'whatsapp://send?phone=+XXXXXXXXXXX';
Linking.canOpenURL(url).then((supported) => {
if (supported) {
Linking.openURL(url);
} else {
Alert.alert(
'Alert',
'WhatsApp is not installed',
);
}
});
};
// This is on the render section from my screen
<DefaultButton
title="¡Say Hi!"
containerStyles={styles.centeredButton}
onPress={() => this.openWhatsappUrl()}
/>
The AppDelegate.m file has this configuration
#import <React/RCTLinkingManager.h>
...
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
return [RCTLinkingManager application:application openURL:url options:options];
}
The Info.plist file
<key>LSApplicationQueriesSchemes</key>
<array>
<string>whatsapp</string>
<string>fbapi</string>
<string>fb-messenger-share-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
React Native version
System:
OS: macOS Mojave 10.14.6
CPU: (4) x64 Intel(R) Core(TM) i5-5350U CPU # 1.80GHz
Memory: 24.91 MB / 8.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.16.0 - /usr/local/bin/node
Yarn: 1.22.0 - ~/.yarn/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 23, 24, 25, 26, 27, 28, 29
Build Tools: 23.0.1, 25.0.2, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.0, 28.0.1, 28.0.2, 28.0.3, 29.0.2
System Images: android-26 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.0 AI-171.4408382
Xcode: 11.3/11C29 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.5 => 0.60.5
npmGlobalPackages:
create-react-native-app: 2.0.2
react-native-cli: 2.0.1
I answer to myself, removing the plus sign from the phone number fix the error and now it works.

react native the [[DEFAULT]] firebaseapp is not initialized react-native-firebase

I am trying to use react-native-firebase module with react native.
Error I am getting:
Steps I followed:
Step1: Created basic app
react-native init myFirebaseApp
Moved to project
cd myFirebaseApp
Installed module
npm install --save react-native-firebase
Step 2: Setup Firebase SDK (https://rnfirebase.io/docs/v4.2.x/installation/ios)
created firebase app and downloaded GoogleService-Info.plist for iOS
copied
GoogleService-Info.plist
in project, then
pod init
Add these line to pod file
pod 'Firebase/Core'
pod 'Firebase/Firestore'
Installed dependencies
pod install
and finally linked library
react-native link
Someone can guide me what I am missing or doing wrong?
Modify your AppDelegate.h and AppDelegate.m files
In AppDelegate.h add this,
#import <Firebase.h>
And in AppDelegate.m add [FIRApp configure];
#import <React/RCTRootView.h>
#import <ReactNativeNavigation/ReactNativeNavigation.h>
#implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[FIRApp configure]; // <=== Add this line
NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:#"index" fallbackResource:nil];
[ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];
return YES;
}
#end

Resources