Can't migrate to 3.0 pods libraries - swift

I use Kanna and Reachability libraries. And seems they already migrated to swift 3. I use Cocoapods:
# 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 'MyProj' do
pod 'Kanna', '~> 2.0.0'
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
Got error when do import:
import Kanna
import ReachabilitySwift
Module compiled with Swift 2.3 cannot be imported in Swift 3.0
Flag: Use legacy swift versions everywhere set to No

Found solution here. Need to delete rm -rf ~/Library/Developer/Xcode/DerivedData/ This folder was cached.

Related

Xcode Error Failed to build module - SDK not supported

I am trying to implement the in-app Chat SDK from Mirrorfly to my project, however when i try to initialize their UIKit i get the following error:
Failed to build module 'FlyUIKit' for importation due to the errors
above; the textual interface may be broken by project issues or a
compiler bug.
I tried deleting my cache as well as re-installing all my Cocoapod dependencies, which didn't help. Afterwards i updated my xcode since it might have been an xcode problem but afterwards i got this error:
Failed to build module 'FlyUIKit'; this SDK is not supported by the
compiler (the SDK is built with 'Apple Swift version 5.7.1
(swiftlang-5.7.1.135.3 clang-1400.0.29.51)', while this compiler is
'Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5
clang-1400.0.29.51)'). Please select a toolchain which matches the
SDK.
My Settings are:
MacBook Pro (M1)
MacOs Ventura
Xcode 14.2
enable Bitcode is disabled
BUILD_LIBRARY_FOR_DISTRIBUTION is true
other than that SDK there was nothing else imported.
My Podfile:
target 'iosApp' do
use_frameworks!
platform :ios, '14.1'
pod 'shared', :path => '../shared'
pod 'Alamofire'
pod 'XMPPFramework/Swift'
pod 'Toaster'
pod 'Firebase/Auth'
pod 'Firebase/Crashlytics'
pod 'Firebase/Analytics'
pod 'Firebase/Messaging'
pod 'SDWebImage'
pod 'libPhoneNumber-iOS'
pod 'NicoProgress'
pod 'SocketRocket'
pod 'Socket.IO-Client-Swift', '~> 15.2.0'
pod 'GoogleWebRTC' # WebRTC for Calls
pod 'RealmSwift', '10.20.1'
pod 'IQKeyboardManager'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.1'
config.build_settings['ENABLE_BITCODE'] = 'NO'
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'No'
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
end

Flutter iOS build warnings

When I try to archive my flutter product for release I am getting lot of warnings as shown below.
Minimum deployment iOS version: 12
Xcode version: 14.2
My POD file for installation as below:
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
end
end
end
You have to change this line in your podfile at root/ios/Podfile to the desired target version.
Then you'd ideally reinstall all pods or do a repo update
Happy coding :)

CocoaPods. The iOS deployment target IPHONE_DEPLOYMENT_TARGET

I have a host of CocoaPods that all throwing this warning:
The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99.
anyway to correct these?
Would converting to Swift Packages help, and if so is there a way to tell if a Pod has a swift package?
Thanks all,
In the pod file at the end, you can use this to set the minimum os version for each of your pods to a specific version and then run pod install command from terminal. This will change deployment target version.
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
end

Migrating to CocoaPods 1.1.1 with WatchKit Extension

I am trying to migrate to the latest version of CocoaPods from 0.39. Here is my original podfile:
platform :ios, '10.0'
use_frameworks!
target 'MyApp' do
pod 'SwiftyJSON'
pod 'Alamofire', '~> 4.0'
pod 'AlamofireImage', '~> 3.1'
end
target 'MyAppWatchKitApp' do
end
target 'MyAppWatchKitApp Extension' do
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
After reading the CocoaPods 1.0 Migration Guide and this StackOverflow post I tried updating my podfile:
platform :ios, '10.0'
target 'MyApp' do
use_frameworks!
pod 'SwiftyJSON'
pod 'Alamofire', '~> 4.0'
pod 'AlamofireImage', '~> 3.1'
target 'MyAppWatchKitApp' do
end
target 'MyAppWatchKitApp Extension' do
end
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
Saving the podfile, running pod update in Terminal, then opening and building the project, I see the following error (client name censored, replace with "MyApp" to match pod files above):
Other things I've tried:
Doing a pod install in addition to pod update
Deleting derived data
I have some good experience with Swift and Xcode but pods are still relatively new to me. Maybe I'm missing something very basic. Any help is greatly appreciated!
Add this line to your post install step in the Podfile.
config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'

CocoaPods Bridging Header file not found

New developer here, and I'm currently building an app in swift. We are using cocoapods, but after running pod install, we get an error in the objective-c bridging header saying that the file cannot be found, but for any and every file in our bridging header. For example, we use DateTools. We pod install it, in the bridging header we put:
#import <DateTools/DateTools.h>
but then, upon running, it errors, saying that 'Datetools/Datetools.h' file not found. I've already looked through a lot of other similar posts (like this, this, or this), but none have solved the issue. Any help would be greatly appreciated!
When using the use_frameworks! instruction in Cocoapods, the bridging header is not required for importing Objective-C pods in Swift.
Simply set your desired pods into your podfile:
#Uncomment this line to define a global platform for your project
platform :ios, '9.0'
#Uncomment this line if you're using Swift
use_frameworks!
target 'YourProject' do
#Swift Pods
pod 'Alamofire'
pod 'ActiveLabel'
#ObjC Pods
pod 'IDMPhotoBrowser'
pod 'Firebase'
#This stuff is to set the SWIFT_VERSION
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '2.3'
end
end
end
end
Run pod install. Run pod update (should not be necessary, but for some reason I'm getting updates almost every time, even after clean install). Close Xcode and reopen using the white xcworkspace file.
import Alamofire
import ActiveLabel
import IDMPhotoBrowser
import Firebase
Done.