My iOS app is developed with Xcode 7.3.
I want to use Xcode 8, and I'm using Cocoapods to generate project.
I don't want to migrate my code to swift 3.0 for now, I want to use Swift 2.3 for my project code.
Here my Podfile:
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
target 'xxxxx' do
platform :ios, '9.3'
pod 'RESideMenu', '4.0.7'
pod 'Alamofire', '3.4.1'
pod 'AlamofireImage', '2.4.1'
pod 'JSONHelper', '2.1.0'
pod 'SwiftyJSON', '2.3.2'
pod 'ObjectMapper', '1.3.0'
pod 'AlamofireObjectMapper', '3.0.2'
pod 'RealmSwift', '~> 0.97'
pod 'KVNProgress', '2.3'
pod 'CalendarLib', '2.0'
pod 'Charts/Realm', '2.2.5'
pod 'SwiftEventBus', :tag => '1.1.0', :git => 'https://github.com/cesarferreira/SwiftEventBus.git'
pod 'RichEditorView'
pod 'SwiftHSVColorPicker'
pod 'Google/Analytics'
pod 'Fabric'
pod 'Crashlytics'
end
Getting errors event if I set Use Legacy Swift Language Version to YES
Is it possible to update pods to Swift 3 version, and still use Swift 2.3 for my project?
You can't, you either use everything in Swift 2.3 or Swift 3.0. My tip for you is, if you don't wanna update to Swift 3.0, then search all your dependencies to look for a branch or version that supports 2.3.
P.S.: It's Xcode :)
Your can use pods like this :
Please add SWIFT_VERSION in your project settings and then update your pods like this:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
target 'xxxxx' do
platform :ios, '9.3'
pod 'RESideMenu', '4.0.7'
pod 'Alamofire', '3.4.1'
pod 'AlamofireImage', '2.4.1'
pod 'JSONHelper', '2.1.0'
pod 'SwiftyJSON', '2.3.2'
pod 'ObjectMapper', '1.3.0'
pod 'AlamofireObjectMapper', '3.0.2'
pod 'RealmSwift', '~> 0.97'
pod 'KVNProgress', '2.3'
pod "CalendarLib", '2.0'
pod 'Charts/Realm', '2.2.5'
pod 'SwiftEventBus', :tag => '1.1.0', :git => 'https://github.com/cesarferreira/SwiftEventBus.git'
pod "RichEditorView"
pod 'SwiftHSVColorPicker'
pod 'Google/Analytics'
pod 'Fabric'
pod 'Crashlytics'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '2.3' || '3.0'
config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'NO'
end
end
end
And then use install pods command.
Related
The main problem is am using currently Moya on my app, but I want to use some functions from "Moya/RxSwift" pod, the problem I am having is when i change the pod the Alamofire downgrades to 4.9.1 and produce a lot of error in the code, there is a way to edit the pod file to keep using Alamofire 5?
My PODS in the podfile:
# Uncomment this line to define a global platform for your project
# platform :ios, ’10.0’
platform :ios, '10.0'
use_frameworks!
inhibit_all_warnings!
def core_pods
#core
pod 'ZXingObjC'
pod 'Moya/RxSwift'
pod 'RxSwift'
pod 'RxCocoa'
pod 'RxViewModel'
pod 'XCGLogger', '~> 6.1.0'
pod 'SwiftyJSON'
pod 'CryptoSwift', :git => "https://github.com/krzyzanowskim/CryptoSwift", :branch => "master"
pod 'AFDateHelper'
#pod 'Fabric'
#pod 'Crashlytics'
end
def ui_pods
pod 'SVProgressHUD'
pod 'CropViewController'
pod 'lottie-ios'
end
examples of some errors i got on the code because of the downgrade:
I am currently trying to integrate React-Native into the app by making it a component pod as mentioned at:
https://artsy.github.io/blog/2018/04/17/making-a-components-pod/
I am able to get it working for the flow mentioned by them. But when implementing it in a legacy codebase I am seeing issues
Some details on the codebase:
- Mix of ObjC and Swift.
- Uses CocoaPods for third party dependencies.
Issue I am facing
- Unable to build system frameworks/modules like UIKit in my bridging header for string.h as well as in Folly (seeing in the screenshot below). Happens to CoreFoundation, Darwin as well.
Contents of Podfile
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
inhibit_all_warnings!
def shared_pods
pod 'AFNetworking', '3.1'
pod 'AFNetworkActivityLogger', :git => 'https://github.com/AFNetworking/AFNetworkActivityLogger.git', :branch => '3_0_0'
pod 'AppsFlyerFramework'
pod 'Crashlytics'
pod 'Fabric'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'GoogleAnalytics'
pod 'KeychainAccess'
pod 'LGSemiModalNavController', '0.2.0'
pod 'ObjectMapper', '~> 2.2'
pod 'MZFormSheetPresentationController', '~> 2.4.2'
pod 'SDWebImage', '~> 3.7.2'
pod 'TRVSDictionaryWithCaseInsensitivity', '0.0.2'
pod 'SwiftLint'
pod 'SwiftMoment'
# React Native Support
plugin 'cocoapods-fix-react-native'
pod 'GitDawg', :path => '../GitDawg'
pod 'React', :podspec => 'Local Pods/React.podspec.json'
pod 'yoga', :podspec => 'Local Pods/yoga.podspec.json'
end
target 'RedMart' do
shared_pods
end
target 'RedMartAlphaTests' do
shared_pods
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
end
end
end
The RN components come from the GitDawg pod.
guys,
I have this pod file from a not too old project
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MyApp' do
# Comment the next line if you're not using Swift and don't want to use
dynamic frameworks
use_frameworks!
# Pods for MyApp
pod 'Alamofire', '~> 4.0'
pod 'SwiftyJSON'
pod 'KeychainSwift', '~> 7.0'
pod 'KeychainSwift', '~> 7.0'
pod 'FacebookCore'
pod 'FacebookLogin'
pod 'FacebookShare'
pod 'Fabric'
pod 'Crashlytics'
pod 'RSKImageCropper'
pod 'Koloda', :git => 'https://github.com/Yalantis/Koloda.git', :branch => 'swift-3'
pod 'MBAutoGrowingTextView'
pod 'CCBottomRefreshControl'
pod 'SDAVAssetExportSession', :git => 'https://github.com/rs/SDAVAssetExportSession.git'
pod 'Firebase/Core'
pod 'IQKeyboardManagerSwift'
target 'MyAppTests' do
inherit! :search_paths
end
target 'MyAppUITests' do
inherit! :search_paths
# Pods for testing
end
end
and when I run
pod install
XCode doesn't recognize ProfileHandle variable. I think ProfileHandle is from an older version from any of the pods.
Anyone of you know how to solve it?
Thanks in advance!
I have this in podfile:
pod 'Firebase/Core'
pod 'Firebase/Messaging'
but getting this error:
[!] Unable to find a specification for Firebase/Core
i tried with pod 'Firebase' still can't find it.
Podfile:
# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
target 'caffetouch manager' do
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'Alamofire', '~> 4.0.0'
pod 'AlamofireNetworkActivityIndicator', '~> 2.0.1'
pod 'IQKeyboardManagerSwift', '~> 4.0.6'
pod 'MZFormSheetPresentationController', '~> 2.4.2'
pod 'Kingfisher', '~> 3.1.3'
pod "GMStepper"
pod 'DKImagePickerController', '~> 3.4.0'
pod 'Siren', '~> 1.0.2'
pod 'Eureka', '~> 2.0.0-beta.1'
pod 'SwiftyJSON'
pod 'ObjectMapper', '~> 2.1'
pod 'NVActivityIndicatorView'
pod 'SwiftDate', '~> 4.0.5'
pod 'SimpleAlert' '~> 2.0.1'
pod 'BTNavigationDropdownMenu', :git => 'https://github.com/PhamBaTho/BTNavigationDropdownMenu.git', :branch => 'swift-3.0'
pod 'ENSwiftSideMenu', :git => 'https://github.com/evnaz/ENSwiftSideMenu.git', :branch => 'master'
pod 'SkyFloatingLabelTextField', git: "https://github.com/MLSDev/SkyFloatingLabelTextField.git", branch: "swift3"
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
Try to update pod repository
pod repo update
If doesn't help show log from
pod install --verbose
Edit:
try to add
source 'https://github.com/CocoaPods/Specs.git'
to your Podfile. If doesn't help probably there is a problem with your local pod repo. You can fix this using:
pod repo remove master
pod setup
pod install
try below commands:
pod repo remove master
pod repo update
pod install --verbose
try to delete the file podfile.lock
it helps with issue:
[!] CocoaPods could not find compatible versions for pod
"Firebase/Core": In snapshot (Podfile.lock):
Firebase/Core (= 4.8.1)
Check if your podfile looks like this and then execute pod install:
platform :ios, '10.0'
use_frameworks!
target '<YOUR APP TARGET>' do
# Firebase
pod 'Firebase'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
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
This worked for me by updating cocoapods and my pod repo:
sudo gem install cocoapods
pod repo update
None of the approaches mentioned worked for me. Here is how I made it to work, however:
Comment out all of your pods in your Podfile.
Comment them back in
one-by-one and run pod install after each
Clean and run
I hope it will help somebody.
If it still doesn't work, remove cocoapods directory rm -rf ~/.cocoapods and re-setup cocoapods using pod setup
Hope that helps
had the same problem.
what really worked for me was gem uninstall cocoapods where I found that I had 11 (!) cocoapods versions. I chose to uninstall all and then gem install cocoapods:1.4.0
All good now.
Hello I just delete this row
if you are using unity and try to run for ios
source 'https://github.com/CocoaPods/Specs.git'
I've been trying to solve this issue for a couple days and haven't found a solution. Whenever I try to run a test I receive the error shown below that there are duplicate classes.
I tried these answers but I'm still receiving the duplicate error and my tests won't run
Cocoapods Warning - CocoaPods did not set the base configuration of your project because because your project already has a custom config set
My pod file looks like this:
platform :ios, "8.0"
def project_pods
pod "Braintree"
pod "AFNetworking", "~> 3.0"
pod "MBProgressHUD"
pod "ActionSheetPicker-3.0", "~> 2.0.1"
pod "SCLAlertView-Objective-C", "~> 0.7"
pod "GoogleMaps"
pod "MPSHorizontalMenu"
pod "Fabric"
pod "Crashlytics"
pod "RateView"
pod "QBImagePickerController"
pod "GLCalendarView", "~> 1.0.0"
pod "Heap"
pod "AWSS3"
end
target “iOS_project” do
project_pods
end
target “iOS_projectTests” do
project_pods
end
This is what the error looks like and it is for every cocoapod class:
Class GMSAutocompleteResultsViewController is implemented in both /Users/john/Library/Developer/CoreSimulator/Devices/27CF0470-07AC-4575-8907-A27EE9B357A7/data/Containers/Bundle/Application/7AFB0886-9ED1-464D-8B02-067CDD07511D/iOS_project.app/iOS_project and /Users/john/Library/Developer/Xcode/DerivedData/iOS_projectTests-hezbkjqviaiitthcrrnwetvcojcb/Build/Products/Debug-iphonesimulator/iOS_projectTests.xctest/iOS_projectTests. One of the two will be used. Which one is undefined.
All of the pods are Objective C and I am using a bridging header
Reformat your podfile like this:
platform :ios, "8.0"
def project_pods
pod "Braintree"
pod "AFNetworking", "~> 3.0"
pod "MBProgressHUD"
pod "ActionSheetPicker-3.0", "~> 2.0.1"
pod "SCLAlertView-Objective-C", "~> 0.7"
pod "GoogleMaps"
pod "MPSHorizontalMenu"
pod "Fabric"
pod "Crashlytics"
pod "RateView"
pod "QBImagePickerController"
pod "GLCalendarView", "~> 1.0.0"
pod "Heap"
pod "AWSS3"
target "iOS_projectTests" do
inherit! :search_paths
end
end
target "iOS_project" do
project_pods
end
Source: CocoaPods issue #4626
The error indicates that '
GMSAutocompleteResultsViewController' is integrated two time and only one is used from it
If you are not using unit testing case target for now you can remove that portion from the podfile and check again by pod install or pod update
Remove this portion from your podfile
target “iOS_projectTests” do
project_pods
end
For swift it will be good if you set use_frameworks! below the platform version
so your top portion can be like
platform :ios, "8.0"
use_frameworks!
so your new podfile can look like this
platform :ios, "8.0"
use_frameworks!
def project_pods
pod "Braintree"
pod "AFNetworking", "~> 3.0"
pod "MBProgressHUD"
pod "ActionSheetPicker-3.0", "~> 2.0.1"
pod "SCLAlertView-Objective-C", "~> 0.7"
pod "GoogleMaps"
pod "MPSHorizontalMenu"
pod "Fabric"
pod "Crashlytics"
pod "RateView"
pod "QBImagePickerController"
pod "GLCalendarView", "~> 1.0.0"
pod "Heap"
pod "AWSS3"
end
target “iOS_project” do
project_pods
end
target “iOS_projectTests” do
project_pods
end
Hope this helps, if it still shows the error you may put pods directly on the target instead of putting in def at top
Note: For the Google map you can also directly import the framework like import GoogleMaps instead of adding google maps in the bridging header
now, modify Podfile by commenting use_frameworks! ,like below:
platform :ios, '8.0'
#use_frameworks!
target 'ShiBa' do
pod 'SDWebImage'
pod 'AFNetworking'
pod 'MBProgressHUD'
pod 'MJRefresh', '3.1.0'
pod 'UMengAnalytics'
pod 'YYModel'
pod 'AMapLocation'
pod 'pop'
end