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!
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.
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
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.