Working process of pod install command in iOS - ios

I have one doubt about cocoapod. Nowadays we are using dependency manager cocoapod for adding libraries to our project.
For example I added pod 'Alamofire' command in podfile and i run pod install command in my terminal.Then automatically added Alamofire library to our xcode project.This is working fine.
But my doubt is we are mentioned only pod 'Alamofire' in podfile, then how to download this exact library from this single line command? What is the process done in background when i run pod install command?

When you mention just the name of the repository in podfile. It automatically checks the latest version of the library present on GitHub and downloads it.
Here is the detailed log of what happens when you install a pod.
Analyzing dependencies
Updating spec repositories
Updating spec repo `master`
$ /usr/bin/git pull
Already up-to-date.
Finding Podfile changes
- AFNetworking
- HockeySDK
Resolving dependencies of `Podfile`
Resolving dependencies for target `Pods' (iOS 6.0)
- AFNetworking (= 1.2.1)
- SDWebImage (= 3.2)
- SDWebImage/Core
Comparing resolved specification to the sandbox manifest
- AFNetworking
- HockeySDK
Downloading dependencies
-> Using AFNetworking (1.2.1)
-> Using HockeySDK (3.0.0)
- Running pre install hooks
- HockeySDK
Generating Pods project
- Creating Pods project
- Adding source files to Pods project
- Adding frameworks to Pods project
- Adding libraries to Pods project
- Adding resources to Pods project
- Linking headers
- Installing libraries
- Installing target `Pods-AFNetworking` iOS 6.0
- Adding Build files
- Adding resource bundles to Pods project
- Generating public xcconfig file at `Pods/Pods-AFNetworking.xcconfig`
- Generating private xcconfig file at `Pods/Pods-AFNetworking-Private.xcconfig`
- Generating prefix header at `Pods/Pods-AFNetworking-prefix.pch`
- Generating dummy source file at `Pods/Pods-AFNetworking-dummy.m`
- Installing target `Pods-HockeySDK` iOS 6.0
- Adding Build files
- Adding resource bundles to Pods project
- Generating public xcconfig file at `Pods/Pods-HockeySDK.xcconfig`
- Generating private xcconfig file at `Pods/Pods-HockeySDK-Private.xcconfig`
- Generating prefix header at `Pods/Pods-HockeySDK-prefix.pch`
- Generating dummy source file at `Pods/Pods-HockeySDK-dummy.m`
- Installing target `Pods` iOS 6.0
- Generating xcconfig file at `Pods/Pods.xcconfig`
- Generating target environment header at `Pods/Pods-environment.h`
- Generating copy resources script at `Pods/Pods-resources.sh`
- Generating acknowledgements at `Pods/Pods-acknowledgements.plist`
- Generating acknowledgements at `Pods/Pods-acknowledgements.markdown`
- Generating dummy source file at `Pods/Pods-dummy.m`
- Running post install hooks
- Writing Xcode project file to `Pods/Pods.xcodeproj`
- Writing Lockfile in `Podfile.lock`
- Writing Manifest in `Pods/Manifest.lock`
Integrating client project
Please refer to this Link for a detailed version of how CocoaPods work.

Related

XCode - Dependencies for static build in xcframework

Dependencies in static build
I am creating a .xcframework which contains static builds of my SDK for consumption via CocoaPods and SPM.
The framework structure is:
MYSDKAssets.bundle
MySDK.xcframework
- info.plist
- ios-arm-64
- MySDK.swiftmodule
- MySDK.a
- ios-x86_64-simulator
- MySDK.swiftmodule
- MySDK.a
MySDK has two external dependencies: GenericPubSub and GenericAnalytics. The problem I am running into is when I try to install the SDK in an external app via CocoaPods, I am getting an error in the .swiftinterface file
No such module GenericPubSub on the import GenericPubSub line.
I've listed the dependencies in the podspec:
spec.dependency 'GenericPubSub', '~> 1.0.0'
How can I fix this so that my static build can use external dependencies?

Framework not found MapboxCommon.xcframework iOS Xcode

I want to use MapBox Search SDK for iOS. So I've followed this official documentation
Firstly, I've created ".netrc" in my /home directory as instruction and then add this -
use_frameworks!
target "TargetNameForYourApp" do
pod 'MapboxSearchUI', ">= 1.0.0-beta.3", "< 2.0"
end
to podfile. Then run pod install and got this in terminal -
Analyzing dependencies
Downloading dependencies
Installing MapboxCommon (9.0.2)
Installing MapboxMobileEvents (0.10.8)
Installing MapboxSearch (1.0.0-beta.4)
Installing MapboxSearchUI (1.0.0-beta.4)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `MapBox.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 4 total pods installed.
[!] Automatically assigning platform `ios` with version `12.1` on target `MapBox` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
But after running all this I'm getting this error in Xcode -
Framework not found MapboxCommon.xcframework
I've also tried this -
pod deintegrate && pod cache clean --all
pod install
but still the same error.
I think I've followed correctly the documentation and entered the secret API Key correctly. So why am I getting this error?
Edit:
In Project Targets the installed pods are not listed -
But In pod folder in Project directory -
there are other frameworks available which are not available in Xcode Pods Target.
Is that the pointing that the frameworks are not available in the projects?
Edit:
I've checked in my project directory if the Mapbox.common.xcfreamework present or not. And I found that file under pod/mapboxCommon folder
I've been opening my project using MapBox.xcworkspace which file was generated after running pod install.
You are facing this error because you are still trying to build the project file (xcodeproj), not the generated workspace by CocoaPods.
To resolve this issue, open up 'MapBox.xcworkspace' file and use that file to access your projects from now on.

Why doesn't this iOS project build using XCode 11?

I have an iphone app (Swift project) that used to build using an older version of XCode, but I haven't built it for a year (I updated my XCode) and now I can't build it. I tried everything I found after googling the problem. I get this error every time I try to build it:
unable to spawn process (No such file or directory) (in target 'CombineDataSources' from project 'Pods')
I don't get any other error when I try to build the project, just this one.
I tried cleaning the build folder, deleting all pods (Library/Cashes/CocoaPods/Pods), deleting derived data (Library/Developer/XCode/DerivedData), deleting the xcworkspace file, then running pod deintegrate command in terminal, then running pod install command in terminal.
Analyzing dependencies
Downloading dependencies
Installing CombineDataSources (0.2.2)
...
Generating Pods project
Integrating client project
Pod installation complete! There are 14 dependencies from the Podfile and 20 total pods installed.
Podfile (part that contains the package that's part of the Xcode error):
pod 'CombineDataSources', '~> 0.2.2'
Podfile.lock (part that contains the package that's part of the Xcode error):
PODS:
- CombineDataSources (0.2.2)
DEPENDENCIES:
- CombineDataSources (~> 0.2.2)
SPEC REPOS:
trunk:
- CombineDataSources
SPEC CHECKSUMS:
CombineDataSources: 2315365365i8746865375
All pods were successfully installed, no errors, no warnings, but my project still gives the unable to spawn process error. Anyone has any idea what else I could try? Any help, any suggestion would be very much appreciated!
I cannot manage to find the spec 0.2.2 in neither the CombineDataSources nor in the specs repo;
The 0.2.2 release seems that doesn't contain the podspec.
In repo not found: https://github.com/CombineCommunity/CombineDataSources/tree/0.2.2
In cocoapod specs not found:
https://github.com/CocoaPods/Specs/search?q=combinedatasources&unscoped_q=combinedatasources
Only the latest version seems to contain a podspec. (0.2.5)
Could you try with to pod install or bundle exec pod install with that version?

iOS, install library via pod install, still get "No such module"

Pardon me for beginner's question,
I tried to install a library named NetworkKit, and follow their instruction by doing
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'NetworkKit'
and then
pod install
but still in the swift file, I got the error "No such module" at the line import NetworkKit.
Any idea how to fix this? Thanks
Update: This is the output of pod install --verbose
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target
`Pods-networkingexamle`: (``)
Using `ARCHS` setting to build architectures of target
`Pods-networkingexamleTests`: (``)
Using `ARCHS` setting to build architectures of target
`Pods-networkingexamleUITests`: (``)
Finding Podfile changes
- NetworkKit
Resolving dependencies of `Podfile`
Comparing resolved specification to the sandbox manifest
- NetworkKit
Downloading dependencies
-> Using NetworkKit (1.3.2)
- Running pre install hooks
Generating Pods project
- Creating Pods project
- Adding source files to Pods project
- Adding frameworks to Pods project
- Adding libraries to Pods project
- Adding resources to Pods project
- Linking headers
- Installing targets
- Installing target `NetworkKit` iOS 8.0
- Generating Info.plist file at `Pods/Target Support
Files/NetworkKit/Info.plist`
- Generating module map file at `Pods/Target Support
Files/NetworkKit/NetworkKit.modulemap`
- Generating umbrella header at `Pods/Target Support
Files/NetworkKit/NetworkKit-umbrella.h`
- Installing target `Pods-networkingexamle` iOS 8.0
- Generating Info.plist file at `Pods/Target Support
Files/Pods-networkingexamle/Info.plist`
- Generating module map file at `Pods/Target Support
Files/Pods-networkingexamle/Pods-networkingexamle.modulemap`
- Generating umbrella header at `Pods/Target Support
Files/Pods-networkingexamle/Pods-networkingexamle-umbrella.h`
- Installing target `Pods-networkingexamleTests` iOS 8.0
- Generating Info.plist file at `Pods/Target Support
Files/Pods-networkingexamleTests/Info.plist`
- Generating module map file at `Pods/Target Support
Files/Pods-networkingexamleTests/Pods-networkingexamleTests.modulemap`
- Generating umbrella header at `Pods/Target Support
Files/Pods-networkingexamleTests/Pods-networkingexamleTests-umbrella.h`
- Installing target `Pods-networkingexamleUITests` iOS 8.0
- Generating Info.plist file at `Pods/Target Support
Files/Pods-networkingexamleUITests/Info.plist`
- Generating module map file at `Pods/Target Support
Files/Pods-networkingexamleUITests/Pods-networkingexamleUITests.modulemap`
- Generating umbrella header at `Pods/Target Support
Files/Pods-networkingexamleUITests/Pods-networkingexamleUITests-umbrella.h`
- Running post install hooks
- Writing Xcode project file to `Pods/Pods.xcodeproj`
- Generating deterministic UUIDs
- Writing Lockfile in `Podfile.lock`
- Writing Manifest in `Pods/Manifest.lock`
Integrating client project
Integrating target `Pods-networkingexamle` (`networkingexamle.xcodeproj` project)
Integrating target `Pods-networkingexamleTests` (`networkingexamle.xcodeproj` project)
Integrating target `Pods-networkingexamleUITests` (`networkingexamle.xcodeproj` project)
- Running post install hooks
- cocoapods-stats from
`/Library/Ruby/Gems/2.0.0/gems/cocoapods-stats-1.0.0/lib/cocoapods_plugin.rb`
Sending stats
- NetworkKit, 1.3.2
Pod installation complete! There is 1 dependency from the Podfile and 1 total
pod installed.
[!] Your Podfile has had smart quotes sanitised. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes in your editor of choice.
Update 2:
The answer is in Thanh Pham's and Shayan Jali's comment: I have to open xcworkspace after install the pod, instead of the xcproject
Let me put the answer here for future readers:
The output of pod install --verbose indicates that the pod has been installed successfully. However, you have to open the .xcworkspace file generated by CocoaPods instead of the .xcproject file.
It is also worth mentioned that the pod can be compiled on Xcode 7 but not Xcode 8 since it has not been updated to Swift 2.3 nor 3.0 at the time of this post.
“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.
The NetworkKit isn't configured with the latest swift syntax. So, use this link Xcode 8 Beta 3 Use Legacy Swift issue to resolve it.
It is import NewsstandKit, the import NewtworkKit is not working.

Running Cocoapods "pod install" Causes Libraries to Disappear

We are having a problem with an existing project. Running pod install causes our existing Pods to break.
Our existing project looks like this:
After I run pod install, several of the libraries that appear in the Products directory and under the Targets are gone, and the app won't compile:
Here is the output from pod install --verbose
myapp-Macbook-Air:myapp username$ pod install --verbose
Preparing
Updating local specs repositories
Updating spec repo `master`
$ /usr/bin/git pull --ff-only
Already up-to-date.
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods`:
(`$(ARCHS_STANDARD)`)
Finding Podfile changes
- Dropbox-iOS-SDK
- FiksuSDK
- GoogleAnalytics
- Localytics
- MobileAppTracker
- SDWebImage
Resolving dependencies of `Podfile`
Comparing resolved specification to the sandbox manifest
- Dropbox-iOS-SDK
- FiksuSDK
- GoogleAnalytics
- Localytics
- MobileAppTracker
- SDWebImage
Downloading dependencies
-> Using Dropbox-iOS-SDK (1.3.13)
-> Using FiksuSDK (4.4.1)
-> Using GoogleAnalytics (3.13.0)
-> Using Localytics (3.5.0)
-> Using MobileAppTracker (3.7)
-> Using SDWebImage (3.7.2)
- Running pre install hooks
Generating Pods project
- Creating Pods project
- Adding source files to Pods project
- Adding frameworks to Pods project
- Adding libraries to Pods project
- Adding resources to Pods project
- Linking headers
- Installing targets
- Installing target `SDWebImage` iOS 7.0
- Installing target `Pods` iOS 7.0
- Running post install hooks
- Writing Xcode project file to `Pods/Pods.xcodeproj`
- Generating deterministic UUIDs
- Writing Lockfile in `Podfile.lock`
- Writing Manifest in `Pods/Manifest.lock`
Integrating client project
Integrating target `Pods` (`myapp.xcodeproj` project)
Adding Build Phase 'Embed Pods Frameworks' to project.
- Running post install hooks
- cocoapods-stats from
`/usr/local/lib/ruby/gems/2.1.0/gems/cocoapods-stats-0.6.2/lib/cocoapods_plugin.rb`
Sending stats
- Dropbox-iOS-SDK, 1.3.13
- FiksuSDK, 4.4.1
- GoogleAnalytics, 3.13.0
- Localytics, 3.5.0
- MobileAppTracker, 3.7
- SDWebImage, 3.7.2
Pod installation complete! There are 6 dependencies from the Podfile and 6
total pods installed.
[!] The `myapp [Debug]` target overrides the `GCC_PREPROCESSOR_DEFINITIONS` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
(We've always had that GCC_PREPROCESSOR warning)
Any ideas about what be happening here, would be appreciated.
Some other notes: We are having this problem on Xcode 6 and Xcode 7, but both machines are running OS X 10.11, which might be the problem. Cocoapods v0.39.0. Also tried downgrading to Cocoapods v0.25.0 but the same problem occurs.

Resources