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
Related
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.
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 am trying to implement PushNotificationIOS with a detached Expo app. I am running SDK 21.0.0 (React Native 0.48).
I am getting React/RCTEventEmitter file not found
I have completed the following steps:
Open my .xcworkspace project
Drag the RCTPushNotification.xcodeproj into my Libraries folder
Added libRCTPushNotification.a into App > Build Phases > Link Binary With Libraries
Added $(SRCROOT)/../node_modules/react-native/Libraries under Header Search Paths - I also tried without the /../. I have a bunch of Pods in the Header Search Paths list too.
I then added the following into AppDelegate.m but when I click through to the file (⌘ + click), I get a question mark.
#import <React/RCTPushNotificationManager.h>
If I change it to the below, it works, I can click through
#import "RCTPushNotificationManager.h"
However, this is my problem
When I clean and build my project, I get the below error in RCTPushNotificationManager.h to say:
'React/RCTEventEmitter.h' file not found
#Dan I have ran into this exact same issue, it also occurs for RCTLinking, and other libraries dependent on eventEmitter.h and a detached Expo project.
The issue turns out to be that RCTPushNotification doesn't have the reference to React from Cocoapods file React since Expo manages React in Cocoapods. So you should go into RCTPushNotification.xcodeproj then into Targets - RCTPushNotification Header Search Paths and add the link to "ios/Pods/Headers/Public/React" and set to recursive.
The easiest way to do the above is navigate to your iOS/Pods/Headers/Public/React and drag and drop the folder straight into build settings for header search paths like the below image.
Heads up finally after this you will have to reference ReactCommon/yoga most likely as well, ReactCommon/yoga however should be in your 'node_modules/react-native/ReactCommon/yoga'
This works for me on detached Expo project
"react": "16.6.3",
"react-native": "0.58.6",
Add 'RCTPushNotification' to your pod and run pod install
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'RCTPushNotification',
]
Since nothing mentioned above worked for me, I started experimenting, and this is what solved it for me:
1. Link React-Core & Public
As mentioned by Escamilla, in xcode open the RCTPushNotification.xcodeproj and under Build Settings search for header search path and add there the 2 path:
"$(SRCROOT)/../../../../ios/Pods/Headers/Public"
"$(SRCROOT)/../../../../ios/Pods/Headers/Public/React-Core"
2. Copy RCTPushNotificationManager.h manually into React-Core
In the root folder of your project execute:
cp ./node_modules/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.h ./ios/Pods/Headers/Public/React-Core/React
This will copy RCTPushNotificationManager.h wich is in node_modules/react-native/Libraries/PushNotificationIOS/ manually into the React folder which is in ios/Pods/Headers/Public/React-Core/React.
I have no idea if that is a good solution but it works. Maybe if someone could explain me why it was not in there in the first place? That would be golden.
I followed the setup instructions 1 by 1 very carefully doing everything right but nothing worked except the manual copy mentioned above…
Also, this is randomly resetted once in a while and has to be done again -.-'
Open up your project in XCode.
Open up the Libraries folder. You should see React.xcodeproj and several RCT*.xcodeproj.
Drag the React.xcodeproj into each of the other projects.
Click on each project and navigate to the Build Phases tab.
Click on Target Dependencies and add React as a target dependency
Just follow these steps:
create project react-native init project.
add this line to pod file in ios folder: pod 'React-RCTPushNotification', :path => '../node_modules/react-native/Libraries/PushNotificationIOS'
cd ios && pod install
cd .. && react-native run-ios
No need to do messy manual linking
Replace #import RCTEventEmitter.h or #import React/RCTEventEmitter.h with #import <React/RCTEventEmitter.h>
Its work for me
this worked for me!
add the missed lib manually
https://github.com/microsoft/react-native-code-push/issues/1565#issuecomment-489738672
USE those libraries:
https://github.com/zo0r/react-native-push-notification
https://github.com/react-native-community/react-native-push-notification-ios
follow step by step,
everything will work
no need anything else
not forget to
pod install
I "pod update", and my RestKit version now is 0.25.0, my RKValueTransformers is 1.1.2, and an error appeared "RKObjectMapping.h" not found.
What did RestKit change in the new version, that I check on the its github cannot find anything.
The following steps can reproduce the error:
1) Create a new project
2) pod init
Podfile looks like:
platform :ios, '8.3'
#pod 'RestKit', '~> 0.20.0'
#pod 'RestKit', '~> 0.24.1'
pod 'RestKit'
In all cases of different versions, the issue is the same
3) open .xcworkspace
4) in the viewcontroller.m
#import <RestKit/ObjectMapping/RKObjectMapping.h>
#import <RestKit/ObjectMapping/RKRelationshipMapping.h>
#import <RestKit/Network/RKResponseDescriptor.h>
#import <RestKit/Network/RKObjectRequestOperation.h>
#import <RestKit/Support/RKLog.h>
#import <RestKit/CoreData/RKEntityMapping.h>
#import <RestKit/Network/RKObjectManager.h>
or
#import "RKObjectMapping.h"
#import "RKRelationshipMapping.h"
#import "RKResponseDescriptor.h"
#import "RKObjectRequestOperation.h"
#import "RKLog.h"
#import "RKEntityMapping.h"
#import "RKObjectManager.h"
The error is still there: "RKObjectMapping.h" not found in a file of RestKit Pod
Note: I am using Xcode 7-beta5, Objective-C
There is easy way to work around this problem when you don't want to touch cocoapods. because fixing them itself a hassle. I have fixed my problem as follows:
Click on your project file
Then go to build settings
search for "header search path"
With the drop down just make them recursive.
You Should be looking for following:
${PODS_ROOT}/Headers/Public/AFNetworking
${PODS_ROOT}/Headers/Public/Bolts
${PODS_ROOT}/Headers/Public/ISO8601DateFormatterValueTransformer
${PODS_ROOT}/Headers/Public/RKValueTransformers
${PODS_ROOT}/Headers/Public/RestKit
${PODS_ROOT}/Headers/Public/SOCKit
${PODS_ROOT}/Headers/Public
After a while struggling, I noticed the error is not from RestKit. It comes from upgrading the latest version of cocoapods (0.39.beta.4).
The Header Search Path is not in recursive mode anymore.
The workaround is just downgrade the version of cocoapods to 0.38.0.
1) remove the latest version of cocoapod
sudo gem uninstall cocoapods
2) install the 0.38.0 version
sudo gem install cocoapods -v 0.38.0
Hope can help someone.
Updated:
Thanks Vig that we can do pod with a specific version:
pod _0.38.0_ update
pod _0.38.0_ install
This has finally been fixed in the development branch of RestKit with the final patch being in 1d8f3e332, I think.
Hopefully it will be merged into master soon.
For now, if you're feeling brave, you can use
pod 'RestKit', :git => 'git#github.com:RestKit/RestKit.git', :commit => '1d8f3e3325d959094a3f96c832bf9f54c9c48df3'
I solved this by building pods as frameworks.
use_frameworks!
I have added GitHub's Mantle project to a iOS 6 project using CocoaPods:
$ pod search Mantle
$ vim Podfile // here I added pod 'Mantle'
$ pod install // this installs Mantle 1.0
Then I have added the ($inherited) variable to the Header Search Paths of project's 'Build Settings' section, before my custom search paths. When importing the Mantle header file Xcode complains with
#import "Mantle.h" // => 'Mantle/MTLJSONAdapter.h' file not found
Am I missing some step? I have other pods installed as well (AFNetworking and SSKeychain) but only Mantle is giving me issues.
I have also added SSToolkit but following the instructions on its 'Getting started', i.e. not using CocoaPods.
Since the problem seemed to be related with the Xcode project/workspace configuration I tried all kind of 'cleaning' solutions:
Delete the Pods directory, the Podfile.lock file and install everything from scratch.
Delete the MyProject.xcworkspace directory and repeat step 1
Enter MyProject.xcodeproj, delete project.xcworkspace and xcuserdata directories and repeat step 1.
Go to the global Xcode directory (/Users/my_user/Library/Developer/Xcode), remove everything related to the project, specially the DerivedData subdirectory, and repeat step 1.
The final step seems to be the final solution, though I cannot tell which file/folder removal did the trick.
Have you added Mantle to your Podfile? You mention running pod install Mantle which doesn't/shouldn't do anything but show an error. ([!] Unrecognized argument:Mantle'`)
After you add Mantle to your Podfile and run pod install you should be able to link Mantle.h directly and there will be a few directories in your xcworkspace and the Pods project. After this you can use #import "Mantle.h" no issues.
I had the same problem, but the problem appears to simply be that my Mantle pod was too old. Changed version to '2.0.5' and pod updated, things work fine.