I have a problem with my swift project on XCode. I use Cocoapods for the frameworks.
My project don't build. I have this error : No such module 'ObjectMapper'.
I have tried pod install, pod update, pod deintegrate, clean build folder, delete .xcworkspace file, delete derived data, update XCode, but nothing work.
The problem isn't the code because it had work well for this mac last week and today on other mac. It appeared after changing branches on my git.
Here is my pod file:
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
def pods
platform :ios, '13.2'
pod 'RESideMenu'
pod 'Alamofire', '~> 4.5'
pod 'AlamofireImage', '~> 3.1'
pod 'JSONHelper'
pod 'SwiftyJSON'
pod 'Google/Analytics'
pod 'ObjectMapper', '~> 3'
pod 'AlamofireObjectMapper', '~> 5.0'
pod 'RealmSwift', '~> 3.18.0'
pod 'KVNProgress'
pod 'CalendarLib'
pod 'Charts', '3.2.1'
pod 'SwiftEventBus', :tag => '2.2.0', :git => 'https://github.com/cesarferreira/SwiftEventBus.git'
pod 'RichEditorView', :git => 'https://github.com/T-Pro/RichEditorView.git', :branch => 'master'
pod 'SwiftHSVColorPicker'
pod 'Crashlytics'
pod 'Toucan'
pod 'RFQuiltLayout'
pod 'Kingfisher'
pod 'CropViewController', :tag => '2.4.0', :git => 'https://github.com/TimOliver/TOCropViewController.git'
pod 'MatomoTracker', '~> 7'
pod 'MaterialShowcase'
pod 'UIDeviceIdentifier', :git => 'https://github.com/squarefrog/UIDeviceIdentifier.git'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if ['RichEditorView', 'Toucan'].include? target.name
config.build_settings['SWIFT_VERSION'] = '4.0'
else
config.build_settings['SWIFT_VERSION'] = '4.2'
end
end
end
end
target 'targetName' do
pods
end
Related
I am developing a React Native Application and I already managed to run it on android platform without any problem. However I got an error in xcode. It is building the project and running it but after I pass the firebase authentication part, it results in failure.
Failure:
*** Assertion failure in std::string firebase::firestore::remote::LoadGrpcRootCertificate()(), ..myProject/ios/Pods/FirebaseFirestore/Firestore/core/src/firebase/firestore/remote/grpc_root_certificate_finder_apple.mm:61
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'FIRESTORE INTERNAL ASSERTION FAILED: Could not load root certificates from the bundle. SSL cannot work. (expected path)'
My Podfile:
# File contents of "ios/Podfile"
platform :ios, '9.0'
target 'myProject' do
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge',
'DevSupport',
# the following ones are the ones taken from "Libraries" in Xcode:
'RCTAnimation',
'RCTActionSheet',
'RCTBlob',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket'
]
# the following dependencies are dependencies of React native itself.
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga/Yoga.podspec'
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/GLog.podspec'
# your other libraries will follow here!
pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios'
pod 'Firebase/Core', '~> 5.15.0'
pod 'Firebase/Auth', '~> 5.15.0'
pod 'Firebase/Firestore', '~> 5.15.0'
pod 'Firebase/Messaging', '~> 5.15.0'
pod 'Firebase/Database', '~> 5.15.0'
pod 'Firebase/Storage', '~> 5.15.0'
pod 'RNGoogleSignin', :path => '../node_modules/react-native-google-signin'
pod 'GoogleSignIn', '~> 4.4.0'
pod 'rn-fetch-blob', :path => '../node_modules/rn-fetch-blob'
pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler/ios'
pod 'react-native-splash-screen', :path => '../node_modules/react-native-splash-screen'
pod 'react-native-image-picker', :path => '../node_modules/react-native-image-picker'
#pod 'react-native-google-places', :path => '../node_modules/react-native-google-places' #there is no such .podspec file add manually
pod 'GoogleMaps'
pod 'GooglePlaces'
pod 'GooglePlacePicker'
pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk'
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
end
# The following is needed to ensure the "archive" step works in XCode.
# It removes React from the Pods project, as it is already included in the main project.
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "React"
target.remove_from_project
end
end
end
install! 'cocoapods',
:deterministic_uuids => false,
:integrate_targets => false
Related questions that i couldn't find the solution:
https://github.com/firebase/firebase-ios-sdk/issues/2177
https://github.com/firebase/firebase-ios-sdk/issues/2385
''' I've been coresponding with the firebase-ios-sdk crew and I
believe we have dentified the issue, and have a workaround for now.
The issue: https://github.com/firebase/firebase-ios-sdk/issues/2604
The workaround: Locate the 'gRPCCertificates.bundle' file. Locate the
root.pem file inside it. Add the root.pem file to your ios app under
the project navigator. ENSURE its target membership is checked for
your app target. ENSURE under Build Phase, 'Copy Bundle Resources' for
your app target that 'root.pem' is added
Wouldn't hurt to clean the build folder probably. Build and run and
you should no longer see the error. (PS SO this is not code.) '''
Blockquote
PS SO, none of that resembles code in any way.
I 100% solved to problem
update your pods
then make sure to delete the app from the phone/simulator
and run the app and it will work fine
I'm migrating my iOS application to Xcode8 and Swift 3. I updated the dependencies version, everythings looks fine except for the SQLite.swift.
In my project on the line "import SQLite" I've this error:
"Module compiled with Swift 2.3 cannot be imported in Swift 3.0 ..."
while I'm targeting the latest version of SQLite.swift.
I also set "Use Legacy Swift Language Version" to yes for the Target "SQlite.swift" under the Pods project.
Any idea what I'm missing ?
My pod file looks like this:
platform :ios, '8.0'
use_frameworks!
target 'XYZ' do
pod 'OAuthSwift', '~> 1.0.0'
pod 'SwiftyJSON', '~> 3.1.1'
pod 'SQLite.swift', '~> 0.10.1'
pod 'Fabric', '~> 1.6.9'
pod 'Crashlytics', '~> 3.8.2'
pod 'PagingMenuController', '~> 1.4.0' #2.0.0 require iOS9+
pod 'SDWebImage/WebP', '~> 4.0.0-beta2'
pod 'ReachabilitySwift', '~> 3'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
I think 0.10 doesn't support swift 3.
Try using the following line in Podfile
pod 'SQLite.swift', :git => 'https://github.com/stephencelis/SQLite.swift.git', :branch => 'master'
use this.definatly work i use this and for me 100% work
use_frameworks!
target 'YourAppTargetName' do
pod 'SQLite.swift', '~> 0.11.3'
end
I'm trying to install the OpenTok pod to my pod file. I have a very big project with many pods installed from the previous developers.
The pod file looks something like this:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
def common_pods
pod 'TPKeyboardAvoiding'
pod 'Fabric'
pod 'Crashlytics'
pod 'FBSDKCoreKit', '~> 4.11.0'
pod 'FBSDKLoginKit', '~> 4.11.0'
pod 'MBProgressHUD'
pod 'BMEApi', :path => 'BMEApi'
pod 'NMRangeSlider'
pod 'SDWebImage'
pod 'ASMediaFocusManager'
pod 'QBImagePickerController', '~> 3.4'
pod 'HPGrowingTextView', '~> 1.1'
pod 'HNKGooglePlacesAutocomplete', '~> 1.1'
pod 'Stripe', '~> 8.0'
end
target 'My_Target' do
common_pods
end
target 'My_Target_Appstore' do
common_pods
end
When I try to add
pod 'OpenTok'
to the "common_pods" section, I get a crash in the terminal when I try to run pod install. It says something along the lines of "Oh no, an error has occurred" asking me to write a ticket.
When I open up my project, all the pods files are messed up and Xcode can't locate any of them.
To test to see if there was something wrong with the framework, I tried installing it on a random test project and it worked perfectly
So the issue here is why won't it install properly on this project, but it will on the other project, and why does it mess up the entire pod file?
Try to add use_frameworks!
So, result pod file (name of the my test project - stackoverflow-39682480):
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
def common_pods
pod 'TPKeyboardAvoiding'
pod 'Fabric'
pod 'Crashlytics'
pod 'FBSDKCoreKit', '~> 4.11.0'
pod 'FBSDKLoginKit', '~> 4.11.0'
pod 'MBProgressHUD'
# I Do not have BMEApi lib, so i disable it of me
#pod 'BMEApi', :path => 'BMEApi'
pod 'NMRangeSlider'
pod 'SDWebImage'
pod 'ASMediaFocusManager'
pod 'QBImagePickerController', '~> 3.4'
pod 'HPGrowingTextView', '~> 1.1'
pod 'HNKGooglePlacesAutocomplete', '~> 1.1'
pod 'Stripe', '~> 8.0'
pod 'OpenTok'
end
target 'stackoverflow-39682480' do
common_pods
end
Result
The question is how to cleanly remove Test in cocoapods PodFile ?
I'ved just recently updated cocoapods 1.0.0 to my project
I ran "pod init" to generate a sample PodFile then put in my pods.
Whole bunch of error generated by the xcode test project ProjectNameTests
http://imgur.com/fUOF18i
How can I cleanly remove the tests ? Even if comment it out there is other problems like Bridging-Header.h cannot find dependent header.
In my current PodFile for 1.0.0:
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'ProjectName' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for ProjectName
pod 'FBSDKCoreKit', '~> 4.9'
pod 'FBSDKLoginKit', '~> 4.9'
pod 'FBSDKShareKit', '~> 4.9'
pod 'SwiftyJSON', '~> 2.3.1'
pod 'Alamofire', '~> 3.0'
pod 'Google/Analytics', '~> 1.0.0'
pod 'Fabric'
pod 'Crashlytics'
pod 'AWSS3'
target 'ProjectNameTests' do
inherit! :search_paths
# Pods for testing
end
end
my previous PodFile, no mention for target project or test:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'FBSDKCoreKit', '~> 4.9'
pod 'FBSDKLoginKit', '~> 4.9'
pod 'FBSDKShareKit', '~> 4.9'
pod 'SwiftyJSON', '~> 2.3.1'
pod 'Alamofire', '~> 3.0'
pod 'Google/Analytics', '~> 1.0.0'
pod 'Fabric'
pod 'Crashlytics'
pod 'AWSS3'
The type of errors you'r defining are not because you have a target to the tests in your Podfile. inherit! :search_paths indicates that this target inherits the pods from the target above it.
One thing you might be getting wrong is that the "target 'ProjectName' do" is not regarding your project name but an actual target of your project.
A target can have a different name then your project.
You can also check the official migration guide Migration Guide.
I'm using CocoaPods with my Xcode 4 project and I have three targets for my project (the default, one for building a lite version and one for building a demo version). All the targets use the same libraries, but CocoaPods is only adding the static library and search paths to the primary target. My podfile looks like this:
platform :ios, '5.0'
pod 'TestFlightSDK', '>= 1.1'
pod 'MBProgressHUD', '0.5'
pod 'iRate', '>= 1.6.2'
pod 'TimesSquare', '1.0.1'
pod 'AFNetworking', '1.1.0'
pod 'KKPasscodeLock', '0.1.5'
pod 'iCarousel', '1.7.4'
The only way I was get this to work was to specify each target individually with all the the pods listed again.
platform :ios, '5.0'
target :default do
pod 'TestFlightSDK', '>= 1.1'
pod 'MBProgressHUD', '0.5'
pod 'iRate', '>= 1.6.2'
pod 'TimesSquare', '1.0.1'
pod 'AFNetworking', '1.1.0'
pod 'KKPasscodeLock', '0.1.5'
pod 'iCarousel', '1.7.4'
end
target :lite do
link_with 'app-lite'
pod 'TestFlightSDK', '>= 1.1'
pod 'MBProgressHUD', '0.5'
pod 'iRate', '>= 1.6.2'
pod 'TimesSquare', '1.0.1'
pod 'AFNetworking', '1.1.0'
pod 'KKPasscodeLock', '0.1.5'
pod 'iCarousel', '1.7.4'
end
target :demo do
link_with 'app-demo'
pod 'TestFlightSDK', '>= 1.1'
pod 'MBProgressHUD', '0.5'
pod 'iRate', '>= 1.6.2'
pod 'TimesSquare', '1.0.1'
pod 'AFNetworking', '1.1.0'
pod 'KKPasscodeLock', '0.1.5'
pod 'iCarousel', '1.7.4'
end
Is there a better way to do this?
Since CocoaPods 1.0 has changed the syntax, instead of using link_with, do something like:
# Note; name needs to be all lower-case.
def shared_pods
pod 'SSKeychain', '~> 0.1.4'
pod 'INAppStoreWindow', :head
pod 'AFNetworking', '1.1.0'
pod 'Reachability', '~> 3.1.0'
pod 'KSADNTwitterFormatter', '~> 0.1.0'
pod 'MASShortcut', '~> 1.1'
pod 'MagicalRecord', '2.1'
pod 'MASPreferences', '~> 1.0'
end
target 'Sail' do
shared_pods
end
target 'Sail-iOS' do
shared_pods
end
Old answer Pre CocoaPods 1.0:
Yes there is a better way! Check out link_with where you can do link_with 'MyApp', 'MyOtherApp' to specify multiple targets.
I use this with unit tests like link_with 'App', 'App-Tests' (beware of spaces in target's names).
Example:
platform :osx, '10.8'
link_with 'Sail', 'Sail-Tests'
pod 'SSKeychain', '~> 0.1.4'
pod 'INAppStoreWindow', :head
pod 'AFNetworking', '1.1.0'
pod 'Reachability', '~> 3.1.0'
pod 'KSADNTwitterFormatter', '~> 0.1.0'
pod 'MASShortcut', '~> 1.1'
pod 'MagicalRecord', '2.1'
pod 'MASPreferences', '~> 1.0'
Approach using abstract_target:
In below example, the 'ShowsiOS', 'ShowsTV' and 'ShowsTests' targets have their own separate pods, plus ShowsKit inherited, because they are all child of the dummy target 'Shows'.
# Note: There are no targets called "Shows" in any of this workspace's Xcode projects.
abstract_target 'Shows' do
pod 'ShowsKit'
target 'ShowsiOS' do
pod 'ShowWebAuth'
end
target 'ShowsTV' do
pod 'ShowTVAuth'
end
# Our tests target has its own copy
# of our testing frameworks
# (beside inheriting ShowsKit pod).
target 'ShowsTests' do
inherit! :search_paths
pod 'Specta'
pod 'Expecta'
end
end
I think better solution is
# Podfile
platform :ios, '8.0'
use_frameworks!
# Available pods
def available_pods
pod 'AFNetworking', '1.1.0'
pod 'Reachability', '~> 3.1.0'
end
target 'demo' do
available_pods
end
target 'demoTests' do
available_pods
end
Reference from : http://natashatherobot.com/cocoapods-installing-same-pod-multiple-targets/
If you want multiple targets to share the same pods, use an abstract_target.
# There are no targets called "Shows" in any Xcode projects
abstract_target 'Shows' do
pod 'ShowsKit'
pod 'Fabric'
# Has its own copy of ShowsKit + ShowWebAuth
target 'ShowsiOS' do
pod 'ShowWebAuth'
end
# Has its own copy of ShowsKit + ShowTVAuth
target 'ShowsTV' do
pod 'ShowTVAuth'
end
end
or just
pod 'ShowsKit'
pod 'Fabric'
# Has its own copy of ShowsKit + ShowWebAuth
target 'ShowsiOS' do
pod 'ShowWebAuth'
end
# Has its own copy of ShowsKit + ShowTVAuth
target 'ShowsTV' do
pod 'ShowTVAuth'
end
source: https://guides.cocoapods.org/using/the-podfile.html
Easiest way is to use an abstract target, where each pod specified will be linked with all targets.
abstract_target 'someNameForAbstractTarget' do
pod 'podThatIsForAllTargets'
end
target 'realTarget' do
pod 'podThatIsOnlyForThisTarget'
end