When ever I write #import FirebaseMessaging; is says -
Module 'FirebaseMessaging' not found
What I did - I install the pods with only Firebase/Core, but after that I realised Firebase/Messaging is also necessary to enable push notifications.
Then I wrote pod 'Firebase/Messaging' in the pod file and install the pods again.
The pod folder contains the folder as Firebase Messaging, but when I import it it says no module found.
You dont need to import FirebaseMessaging
Just add #import Firebase and you will get access to FIRMessaging
I had this issue and I could solve it this way:
if you have a framework that has Firebase/Messaging as it's dependency, and if you have set your framework's build settings to:
Build Active Architecture only
Debug No
Release No
you will get FirebaseMessaging module not found error. just try to make it like this:
Build Active Architecture only
Debug Yes
Release No
Had the same problem. Turns out that you need to place
use_frameworks!
in your Podfile. My Podfile now looks like this:
platform :ios, '8.4'
use_frameworks!
target 'YourTarget' do
pod 'Fabric'
pod 'Crashlytics'
pod 'Bolts'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
# any other Firebase modules you need
end
You don't need to import FirebaseMessaging separately in the latest Firebase SDK according to the latest https://firebase.google.com/docs/cloud-messaging/ios/client:
#import Firebase & just include in your pod file
pod 'Firebase/Messaging'
I hope it will help.
If anything is not working, then you should try
Comment the Firebase and FirebaseMessaging from your Podfile
run pod install
add following to your pod file
pod 'Firebase', '~> 5.4'
pod 'FirebaseMessaging', '~> 3.0'
next is to pod install --repo-update
close your project and open workspace.
when you import the Firebase and try to import FirebaseMessaging, it will show you red marked lines, which means once you import Firebase it already imported the red marked modules in it.
Try it, if it fixes. I have tried and everything is working fine.
Please follow these process :
Clean the Application from product > clean
Close the Application
Again Open workspace of the Application
Again clean.
Hope it will help to you.Thank you.
Related
In Podfile, when using use_frameworks! globally to integrate swift pods in my react native project, Firebase pod files starts giving error
Firebase pods:-
pod 'Firebase'
pod 'Firebase/Messaging'
Error :-
'FirebaseCore/FirebaseCore.h' file not found in RNFIRMessaging.h
issue gets resolved when comment out use_frameworks! in podfile but then i am unable to install swift pods. also tried :modular_headers => true for specific swift pods but pod file is not installing.
Swift pods i am trying to install are :-
pod 'Kite-Print-SDK'
pod 'PayPal-iOS-SDK/Core'
please help me out to resolve this issue..
Please consider check at edit scheme ->Build -> check if Find Implicit Dependencies. if not enable please enable it and rerun.
I actually had a similar problem,
my solution was to change the code manually wherever there was that error.
change
import <FirebaseCore/FirebaseCore.h>
to
import <FirebaseCore.h>
I created a new app and I am trying to use react-native-firebase. But I continually get this error:
RNFirebase core module was not found natively on iOS, ensure you have
correctly included the RNFirebase pod in your projects 'Podfile' and
have run 'pod install'.
See http://invertase.link/ios for the ios setup guide.
Steps that I have done:
yarn add react-native-firebase
react-native link react-native-firebase
Set up my .plist file from Google under .../myproject/ios/myproject
Ran pod updateafter ensuring I was using Ruby 2.5.0
Ran pod install
The pod file that I am currently using is:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'MyProject' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Messaging'
target 'MyProjectTests' do
inherit! :search_paths
# Pods for testing
end
end
These are the versions that I am using:
"react": "^16.3.0-alpha.1",
"react-native": "0.54.2",
"react-native-firebase": "^3.3.1",
If you don't want to manually link, you can try installing RNFirebase as a pod install directly:
pod 'RNFirebase', :path => 'path/to/node_modules/react-native-firebase/ios'
Changing or hardcoding HEADER_SEARCH_PATHS did not help me. When the error recurs, it's not necessary to rm -rf node_modules nor delete the pod file etc, I found it useful to clear the cache.
I always prefer not to use pods with react native, however, the react-native-firebase's instructions for the non-pop installation will not work.
The reason for this is the package's search paths which assumes either /pods or /firebase
Hence, to make it link properly follow these steps:
download firebase sdk
make a folder directly under ios and call it Firebase, copy the frameworks needed of the sdk in that folder WITHOUT keeping the sub-folders (note, you have not entered XCode yet)
If you haven't already npm install -s react-native-firebase
Open XCode and drag and drop the desired frameworks to the Frameworks-folder in XCode (Eg. in my example the contents of the Analytics, Messaging and DynamicLinks folder). Do not copy items when asked as you already have then in the Firebase subfolder of ios:
In XCode right-click Libraries and select "Add files to [project]". Find RNFirebase-project in node_modules and select the RNFirebase.xcodeproj, do not "copy items"
In Project/Target settings go to Linked Frameworks and Libraries. Find and add libRNFirebase.a
In AppDelegate.m make adjustments as per the instructions from react-native-firebase, eg: import <Firebase.h> and [FIRAPP configure]; in didFinishLaunchingWithOptions
In Header Search Paths AND Framework Search Paths, add $(PROJECT_DIR)/Firebase
Don't forget to add you GoogleServices-Info.plist to your project
I had the same problem, while trying to fix it was making my app to crash on start up.
I moved it through the terminal under the ios/AppFolder/ but the Xcode was never aware of this file.
What helped me was to open my project in Xcode. Then left-click on my AppFolder > Add Files and then add the GoogleService-Info.plist.
I manually linked these react-native-firebase/* packages with
react-native link #react-native-firebase/xxx
"#react-native-firebase/analytics","#react-native-firebase/app","#react-native-firebase/auth","#react-native-firebase/crashlytics","#react-native-firebase/messaging"
which generated pod spec in pod and it worked.
I've been trying to get react-native-fbsdk to work with CocoaPods, since I much prefer fetching the Facebook SDK as part of the pod install process, but I haven't had much luck. I'm aware that I can react-native link the npm library and manually download and add the necessary frameworks, but this seems rather silly when I have a perfectly good package manager at my disposal.
Judging by the documentation it should be fairly straight forward - just add the necessary pods to the Podfile, right? But no matter what I try the native FBSDK modules never seem to be included. I've tried a whole host of different Podfiles, some with use_framework! and pod 'Bolts', some with just pod 'FBSDKCoreKit'. This is the one I'm currently on:
target 'FacebookPods' do
pod 'FBSDKCoreKit'
pod 'FBSDKShareKit'
pod 'FBSDKLoginKit'
target 'FacebookPodsTests' do
inherit! :search_paths
end
end
But when I run my test app and try to do anything with the react-native-fbsdk module I get errors complaining about various native modules being undefined. Here's my index.ios.js file, trying to access the LoginManager:
import React, {Component} from "react"
import {AppRegistry, Text} from "react-native"
import {LoginManager} from "react-native-fbsdk"
export default class FacebookPods extends Component {
componentWillMount() {
LoginManager.logInWithReadPermissions(["email"])
.then(() => console.log("Success!"))
.catch((err) => console.log("Failure!", err))
}
render() {
return <Text>Hello World</Text>
}
}
AppRegistry.registerComponent("FacebookPods", () => FacebookPods)
But this throws the error undefined is not an object (evaluating 'LoginManager.logInWithReadPermissions' in FBLoginManager.js. Further inspection of NativeModules shows that no native FBSDK modules are included at all. I also get the following warnings at launch:
2017-07-13 19:50:19.006 [warn][tid:com.facebook.react.JavaScript] Warning: Native component for "RCTFBLikeView" does not exist
2017-07-13 19:50:19.007 [warn][tid:com.facebook.react.JavaScript] Warning: Native component for "RCTFBLoginButton" does not exist
2017-07-13 19:50:19.008 [warn][tid:com.facebook.react.JavaScript] Warning: Native component for "RCTFBSendButton" does not exist
2017-07-13 19:50:19.009 [warn][tid:com.facebook.react.JavaScript] Warning: Native component for "RCTFBShareButton" does not exist
So yea, I'm at a complete loss. In my mind, simply adding the pods ought to be enough to include the frameworks. I've scoured the interwebs for any additional steps that I might've missed, but there isn't much, save for a few issues on the react-native-fbsdk project that have since then been removed.
I encountered this issue and managed to get react-native-fbsdk working with the Facebook SDK installed by adding the following to my pod file:
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'
and importing the following in AppDelegate.m:
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKShareKit/FBSDKShareKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
Note that these imports are different from the suggestion in the react-native-fbsdk readme. That's because FBSDKCorekit.framework, FBSDKShareKit.framework and FBSDKLoginKit.framework are not available.
You also need to link libFBSDKShareKit.a, libFBSDKCoreKit.a and libFBSDKLoginKit.a from the General tab in Xcode. These are the only three Core/Login/Share things available to link. They refer to the pods, and looking in the pods directory you see there are no .framework files, just .h files, so those are the ones we import into AppDelegate.m. That (I think) gives react-native-fbsdk all the files in the the SDK components that it needs.
It's working for me with my Podfile set up this way (not sure Bolts framework pod is needed):
pod 'Bolts'
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'
And I had to do react-native link to make sure that the libRCTFBSDK.a is in the xcode's Build TARGET => build phrases => "Link Binary with libraries" list. If not, you probably need to add the libRCTFBSDK.a in manually. I found that once I ran the react-native link and the libRCTFBSDK.a is in that list, xCode then compiled correctly.
If you use cocoapods, react native will use cocoapods to link link libraries. I created a new project then install and link all packages before run 'pod init' and 'pod install'. Maybe this error from cocoapods when link packages. All packages need 'react-native link' you installed after run 'pod install' it not working. I think we can deintegate cocoapod before run react native link.
Issue
I used to have a functional set of Pods in my project (fully working project) until the latest pod install run, now I'm getting "file not found" errors for the headers mentioned in my bridging header (this is a Swift project with Obj-C includes). After doing some research, it seemed like there should be symlinks to the headers in Pods/Headers, that directory is empty for me. However, the pods themselves have been downloaded and all corresponding Pods/[Lib] directories exist.
Last Known Good State
What I've changed right before this error started occurring was specifying :git and :commit flags for one of the libraries I was pulling in. I then reran pod install and started seeing "file not found" errors. At the time I was using Cocoapods 0.39
Current State
I've tried a few solutions from other stack overflow threads, including adding User Header Search Paths, which had no effect (now back to original), and updating my cocoapods. My current version of cocoapods is now 1.0.0.beta.6. Aside from additional headaches I experienced such as having to rewrite parts of my Podfile to be compliant with new standards, I now seem to be back to the same state (with all libraries successfully downloading, but headers failing to be found).
Here is an example of how I'm including my headers in the bridging header:
// In this header, you should import all the public headers of your framework using statements like #import <MyKit/PublicHeader.h>
#import <CocoaLumberjack/CocoaLumberjack.h>
And here is what my Podfile looks like (I've tried to slim it down to avoid irrelevant content):
source 'https://github.com/CocoaPods/Specs'
platform :ios, '8.0'
use_frameworks!
pod 'CocoaLumberjack', '2.0.0'
pod 'SwiftyJSON', '~> 2.3'
pod 'Classy', :git => 'https://github.com/ClassyKit/Classy.git', :commit => 'c319908f8bded62e268dfd48ee5d65329b819129'
workspace 'my.work-ios'
project 'mywork' # sdk
project 'Examples/example1' # sample project using sdk
project 'my.work-ios.xcodeproj' # placeholder for main project, not really in use
target 'UnitTests' do
pod 'Specta'
pod 'Expecta'
pod 'OCMock'
pod 'OHHTTPStubs'
end
# Copy acknowledgements to the Settings.bundle
post_install do | installer |
require 'fileutils'
pods_acknowledgements_path = 'Pods/Target Support Files/Pods/Pods-Acknowledgements.plist'
settings_bundle_path = Dir.glob("**/*Settings.bundle*").first
if File.file?(pods_acknowledgements_path)
puts 'Copying acknowledgements to Settings.bundle'
FileUtils.cp_r(pods_acknowledgements_path, "#{settings_bundle_path}/Acknowledgements.plist", :remove_destination => true)
end
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['OTHER_SWIFT_FLAGS'] = "-DLEGACY"
end
end
end
Update
After some more digging, I discovered that the culprit is use_frameworks! command, omitting it (and in turn removing Swift libraries, because it's required for them) causes Pods/Headers to be populated with Private and Public directories, along with symlinks for the relevant headers.
This was not the case in previous version of cocoapods, and I'm still trying to understand what's happening, because omitting that command is not a usable workaround for me (given the Swift libraries I use in my app).
Update 2
This is already mentioned in the comments, but for convenience I'm putting this here as well. This seems to be caused by a bug reported in this thread: https://github.com/CocoaPods/CocoaPods/issues/4605#issuecomment-208822149. The thread also suggests a few workarounds that may be good enough for some. For me, they were not, so I went back to 0.39.
Have you tried this settings?
target 'TargetProject' do
pod 'CocoaLumberjack', '2.0.0'
pod 'SwiftyJSON', '~> 2.3'
pod 'Classy', :git => 'https://github.com/ClassyKit/Classy.git', :commit => 'c319908f8bded62e268dfd48ee5d65329b819129'
end
and have this '.swift-version' added? where it contains
'3.0-GM-CANDIDATE'
I'm using this kind of settings for swift 3.0
So I'm trying to include an h file. Here's what that looks like
Then I get
SIOSocket.h file not found
But here are the files....
Any ideas?
Instead of:
#import <SIOSocket.h>
you want:
#import "SIOSocket.h"
The difference is the "..." and the <...>
The right way is the following:
#import "SIOSocket.h"
I suggest you to avoid to import libs manually. The life is to short to lose time on that.
Try cocoapods instead.
The library you are using supports it. You need only to follow the guide provided on the website.
To resume it, you need to:
-Install cocapods if needed
sudo gem install cocoapods
-Create a file in the root directory of your project that contains the following lines. (Choose the minimum version of iOS you are targeting for)
platform :ios, '7.0'
pod 'SIOSocket', '~> 0.0'
-Run pod pod install
Use the create workspace
now you can import the lib using
#import <SIOSocket/SIOSocket.h>
The cocoapods website has all the details you'll need