Cocoapod can't identify my target after it was renamed - ios

I had been using cocoapods to pod stuff but after I've renamed my whole xcode project, the cocoapod doesn't reconise my renamed target when I am trying to pod lottie, and I don't know how to replace the target with the new one
This error showed in terminal
[!] Unable to find a target named `Infinity Math`, did find `Infinity Math.temp_caseinsensitive_rename`, `Infinity Math.temp_caseinsensitive_renameTests`, and `Infinity Math.temp_caseinsensitive_renameUITests`.
My Pod file
platform :ios, '12.0'
target 'Infinity Math' do
use_frameworks!
pod 'UITextField+Shake', '~> 1.2'
pod 'SPAlert'
pod 'CBFlashyTabBarController'
pod 'Spring', :git => 'https://github.com/MengTo/Spring.git'
pod 'lottie-ios'
target 'InfinityMathTests' do
inherit! :search_paths
end
target 'InfinityMathUITests' do
inherit! :search_paths
end
end
What should I do next in order to pod new pods?

Give the targets in the Podfile the same names that show up in Xcode:
target 'Infinity Math' do
target 'Infinity MathTests' do
target 'Infinity MathUITests' do

I've fixed it by renaming the target to the ones in the error
InfinityMath.temp_caseinsensitive_rename,
InfinityMath.temp_caseinsensitive_renameTests, InfinityMath.temp_caseinsensitive_renameUITests
It's weird

Related

Remove pod dependency based on platform

I'm adding an apple watch extension to my project and I'd like to use the same pods I'm using for my main iOS app. However, the podspec I'm using for my iOS app has a dependency that causes an error when I include the watch extension as a target in my podfile. Is there a way to remove dependencies based on platform (ios, watchos)?
The error:
[!] The platform of the target `My Watch Extension` (watchOS 5.2) is not compatible with `Library X (10.1.19)`, which does not support `watchos`.
So far I'm doing the following in my podfile:
target 'My Watch Extension' do
platform :watchos, '5.2'
pod 'MyPod', :path => 'MyPod'
end
And I added the following to my podspec:
s.platforms = { :ios => "10.0", :watchos => "5.2"}
Is it possible to have to separate podspecs?
You can set different dependencies for different platforms
spec.dependency 'Alamofire'
spec.ios.dependency 'Crashlytics'
Here is a simplified version of my podfile. I just include different pod's for the different targets.
def external_dependencies
pod 'Alamofire'
pod 'SQLite.swift/SQLCipher'
end
def caller_id_external_dependencies
pod 'GMCPagingScrollView'
pod 'KeychainAccess'
end
target 'Goob' do
external_dependencies
internal_dependencies
target 'UnitTests' do
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'SQLite.swift/SQLCipher'
inherit! :search_paths
end
end
target 'GoobCallerId' do
caller_id_external_dependencies
end

No such Module Firebase

I have a react-native project and I have to link my xCode project with firebase. Even though I used CocoaPod and manual ways I am getting the error
"No such module as firebase.h".
I have followed all the steps correctly.
Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'App' do
# Uncomment the next line if you're using Swift or would like to use
dynamic frameworks
# use_frameworks!
# Pods for App
target 'App-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
target 'AppTests' do
inherit! :search_paths
# Pods for testing
end
pod 'Google-Mobile-Ads-SDK'
pod 'Firebase/Core', '~> 5.6.0'
pod 'GoogleIDFASupport'
end
target 'App-tvOS' do
# Uncomment the next line if you're using Swift or would like to use
dynamic frameworks
# use_frameworks!
# Pods for App-tvOS
end
I also faced this problem. I was using react-native-firebase package. Please try following their official docs . I would rate their documentation 10/10 as they've explained every possible scenario a developer would face during integration.
Just change value with deployment target of your app.
platform :ios, 'value'
inhibit_all_warnings!
def sharedpods
pod 'Google-Mobile-Ads-SDK'
pod 'Firebase/Core', '~> 5.6.0'
pod 'GoogleIDFASupport'
end
target 'AppTests’ do
use_frameworks!
sharedpods
end
target 'App-tvOSTests’ do
use_frameworks!
sharedpods
end
target 'App-tvOS’ do
use_frameworks!
sharedpods
end
#post_install do |installer|
# installer.pods_project.targets.each do |target|
# puts "#{target.name}"
# end
#end

Please add the host targets for the embedded targets to the Podfile

My project is in Swift 2.0. I am try all possible ways but not found any solution.
My pod file
# Uncomment this line to define a global platform for your project
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, :deployment_target => '8.0'
# ignore all warnings from all pods
inhibit_all_warnings!
use_frameworks!
def available_pods
pod 'IQKeyboardManager'
pod 'Instabug'
pod "TSMessages"
pod 'AsyncSwift' , :git => 'https://github.com/duemunk/Async.git'
pod 'Onboard' # not used
pod 'DZNEmptyDataSet' # not used
pod 'iOS-Slide-Menu'
pod 'Kanna', :git => 'https://github.com/tid-kijyun/Kanna.git'
pod 'HanekeSwift', :git => 'https://github.com/Haneke/HanekeSwift.git'
pod 'Alamofire'
pod 'ObjectMapper', :git => 'https://github.com/Hearst-DD/ObjectMapper.git'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
pod 'ReachabilitySwift'
pod 'SCLAlertView'
pod 'ImageLoader'
pod 'NVActivityIndicatorView', :git => 'https://github.com/ninjaprox/NVActivityIndicatorView.git'
pod 'ActiveLabel'
pod 'MWFeedParser'
pod "SwiftElegantDropdownMenu"
pod 'SwiftHEXColors'
pod 'UITextView+Placeholder'
pod "AFDateHelper"
pod 'DateTools'
pod "SwiftDate", "~> 2.0"
pod 'APAddressBook/Swift'
pod 'FBSDKLoginKit'
pod 'FBSDKCoreKit'
pod 'FBSDKShareKit'
pod 'PusherSwift', git: 'https://github.com/pusher/pusher-websocket-swift.git', branch: 'push-notifications'
end
def available_pods_exc
pod 'Alamofire'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
pod 'ReachabilitySwift'
pod 'Kanna', :git => 'https://github.com/tid-kijyun/Kanna.git'
pod 'AsyncSwift' , :git => 'https://github.com/duemunk/Async.git'
end
target 'link' do
available_pods
end
target 'ReadLaterExtension' do
available_pods_exc
end
target 'Link Tests' do
pod 'Quick', '0.3.1'
pod 'Nimble'
end
I found below error
[!] Unable to find host target(s) for ReadLaterExtension. Please add the host targets for the embedded targets to the Podfile.
Certain kinds of targets require a host target. A host target is a "parent" target which embeds a "child" target. These are example types of targets that need a host target:
- Framework
- App Extension
- Watch OS 1 Extension
- Messages Extension (except when used with a Messages Application)
The problem is not in the podfile, but in the project!
To fix:
Go to XCode
Select your HOST target.
Open the target's 'General' page
In the 'Embedded Binaries' section, make sure your EXTENSION target is present.
In your Podfile you should have:
target 'HostApp' do
....
target 'YourExtension' do
....
end
end
In order to disable building/running the NSExtension you build, you should:
Click the project file in the project navigator
Click the containing app target (the one you DO want to run)
Click Build Phases tab
Open Target Dependencies
Remove the extension (the one you DON'T want to run)
To bring it back, simply click the + sign in the same place and
re-add it.
In my case working sucessfully
For future reference I would like to add one reason I just discovered for this error message:
In the Main Targets Build Phases the section Embed App Extensions has to be above the [CP] Copy Pods Resources and [CP] Embed Pods Frameworkds.

CocoaPods - Unable to find a specification for `GoogleMaps`

I'm new to iOS, i already have Alamofire and MarqueeLabel on my Podfile and now trying to add GoogleMaps, it keeps showing this message,
[!] Unable to find a specification for `GoogleMaps`
My Podfile looks like this
# Uncomment the next line to define a global platform for your project
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
target 'Migapixel' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'GoogleMaps'
pod 'Alamofire',
:git => 'https://github.com/Alamofire/Alamofire.git',
:branch => 'master',
:tag => '4.0.0'
pod 'MarqueeLabel/Swift',
:git => 'https://github.com/cbpowell/MarqueeLabel.git'
# Pods for Migapixel
post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'NO' end end end
target 'MigapixelTests' do
inherit! :search_paths
end
target 'MigapixelUITests' do
inherit! :search_paths
# Pods for testing
end
end
i even tried this
pod 'GoogleMaps',
:git => 'https://github.com/CocoaPods/Specs.git'
What am i doing wrong?
Try removing source 'https://github.com/CocoaPods/Specs.git' and moving use_frameworks! out of the target block. Moreover you don't need to manually set the git path for both Alamofire and MarqueeLabel.
Try this:
platform :ios, '9.0'
use_frameworks!
target 'Migapixel' do
pod 'GoogleMaps'
pod 'Alamofire'
pod 'MarqueeLabel/Swift'
# Pods for Migapixel
end
post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'NO' end end end
target 'MigapixelTests' do
inherit! :search_paths
end
target 'MigapixelUITests' do
inherit! :search_paths
# Pods for testing
end
Edit:
It seems that there's something wrong with your local repo.
Try cleaning and reinstalling:
pod repo remove master
pod setup
i resolved the issue like that with these step:
open terminal.
go to your project path.
type:
pod repo update
install pod again.
After trying many things Here is the fix!!
Imp: Make sure that you have these lines in your PodFile
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
target 'YOUR_APPLICATION_TARGET_NAME_HERE' do
pod 'GoogleMaps'
end
If the above is fine then you need to update the pods:
try the following steps:
Open a new terminal and run the following command in a temp directory.
pod try GoogleMaps
keep patience! It will take some time but will update the pod.
Now try to install the pod in ur project again. It should work.Else try to run the following commands in the project dir:
pod repo update
try again.
Comment in the case of any issue!!
Go to your project directory and delete pods folder and .lock file then run
pod repo update
it helps for me.

Running 1 of 2 custom shell script stuck for 2 minutes in Xcode

Running 1 of 2 custom shell scripts it stuck for 2 minutes while trying to build the app.
I tried to fix with the solution :Xcode custom shell scripts are slowing down the compiling time , but still it slows the build process :(.
Build Stuck for 2m here
Build Phases
Further informations:
Xcode 8.1
Swift 3.0
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 'MyProject' do
# Network
pod 'Alamofire'
pod 'SwiftyJSON'
# UI side
pod 'Material', git: 'https://github.com/CosmicMind/Material.git', branch: 'development'
pod 'SDWebImage'
pod 'UIScrollView-InfiniteScroll'
pod 'TPKeyboardAvoiding'
pod 'SwiftKeychainWrapper', git: 'https://github.com/jrendel/SwiftKeychainWrapper.git', branch: 'develop'
pod 'DropDown'
# Facebook
pod 'FacebookCore'
pod 'FacebookLogin'
pod 'FacebookShare'
# Autolayout
pod 'SnapKit'
pod 'KeepLayout'
# Metrics
pod 'Google/Analytics'
# Fabric.io
pod 'Fabric'
pod 'Crashlytics'
end
target 'MyProjectTests' do
end
target 'MyProjectUITests' do
end
Finally, I found a solution for this. At least the total build time now is 57sec.
I found that 'Embed Pods Framework' (Once 'Embed Pods Framework' and 'CP Embed Pods Framework') builds twice. Anyway, I don't have an idea why I have both of them on build phases.
I found for this on Report Navigator.
Solution:
1) I let only active ✓ Run script only when installing only for'[CP]Embed Pods Framework'
2) Optimization Level on Build Settings for debug was -None. I set to Fast...
3) Tip: use Simulator instead of Device for minimal build time.
Added this at the end of you Podfile
post_install do |installer|
puts("Update debug pod settings to speed up build time")
Dir.glob(File.join("Pods", "**", "Pods*{debug,Private}.xcconfig")).each do |file|
File.open(file, 'a') { |f| f.puts "\nDEBUG_INFORMATION_FORMAT = dwarf" }
end
end

Resources