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.
Related
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.
I've been trying to implement Facebook Login functionality for react native app. Sad how a language developed by Facebook is not properly supporting its own functionalities. Here is the process I've followed:
I installed https://www.npmjs.com/package/react-native-fbsdk-next package as npm i react-native-fbsdk-next which installed "^4.0.0" of this.
I did pod install and it shows a success message as shown in the image below:
Then I opened the iOS project in XCode and added this in my info.plist file:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fbMY_APP_ID</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>MY_APP_ID</string>
<key>FacebookDisplayName</key>
<string>MY_APP_NAME</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-share-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
After that I opened AppDelegate.m and did the following:
...
#import <FBSDKCoreKit/FBSDKCoreKit.h>
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
[[FBSDKApplicationDelegate sharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions];
return YES;
}
- (BOOL)application:(UIApplication *)app
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
if ([[FBSDKApplicationDelegate sharedInstance] application:app openURL:url options:options]) {
return YES;
}
return NO;
}
...
Then when I run the app react-native run-ios there is this really long error that appears and I cannot even copy the full one but here are the last few lines of that error:
Full Log of this error is posted https://github.com/thebergamo/react-native-fbsdk-next/issues/11
** BUILD FAILED **
The following build commands failed:
Ld /Users/chaudhrytalha/Library/Developer/Xcode/DerivedData/fbexampleapp-cbjnhmdbrulusmcwnknqvzbhuegw/Build/Products/Debug-iphonesimulator/fbexampleapp.app/fbexampleapp
normal
The failer message is ever larger than that.
So far what I've tried is I've started a new project from scratch made sure it's running and the moment I install react-native-fbsdk-next and then update pod and run the app again it starts to show this long error.
Open your project in xcode and create an empty .swift file in your project
click next and your project will build
I started a new react native application using :
react-native init myApplication
I started with splash screen so i used this library react native spalsh screen
I linked the library to generate native code using this command :
react-native link react-native-splash-screen
And i added files using Xcode like this :
In XCode, in the project navigator, right click Libraries ➜ Add Files to [your project's name]
Go to node_modules ➜ react-native-splash-screen and add SplashScreen.xcodeproj
In XCode, in the project navigator, select your project. Add libSplashScreen.a to your project's Build Phases ➜ Link Binary With Libraries
To fix 'RNSplashScreen.h' file not found, you have to select your project → Build Settings → Search Paths → Header Search Paths to add: $(SRCROOT)/../node_modules/react-native-splash-screen/ios
I build the app using Xcode in a real Iphone and i get this error in RNSplashScreen.h :
/**
* SplashScreen
* 启动屏
* from:http://www.devio.org
* Author:CrazyCodeBoy
* GitHub:https://github.com/crazycodeboy
* Email:crazycodeboy#gmail.com
*/
#import <React/RCTBridgeModule.h> // <------'React/RCTBridgeModule.h' file not found
#import <UIKit/UIKit.h>
#interface RNSplashScreen : NSObject<RCTBridgeModule>
+ (void)showSplash:(NSString*)splashScreen inRootView:(UIView*)rootView;
+ (void)show;
+ (void)hide;
#end
'React/RCTBridgeModule.h' file not found
the Podfile :
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/React'
...... # other libaries
pod 'react-native-splash-screen', :path => '../node_modules/react-
native-splash-screen'
AppDelegate.m :
#import "AppDelegate.h"
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import "RNSplashScreen.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
.... <------- other code
[RNSplashScreen show];
return YES;
}
Instead of
#import <React/RCTBridgeModule.h>
use
#import "RCTBridgeModule.h"
Hope this helps you. Feel free for doubts.
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
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];
}