I am referencing the pod 'MatomoTracker' in my own pod
I get this error while linting : with pod lint spec
-> TrackerPod.v3 (0.0.1)
- ERROR | [iOS] unknown: Encountered an unknown error (CocoaPods could not find compatible versions for pod "Pods/MatomoTracker/MatomoTracker":
In Podfile:
TrackerPod.v3 (from `/Users/****/Documents/projects/ios/libs/TrackerPod.v3/TrackerPod.v3.podspec`) was resolved to 0.0.1, which depends on
TrackerPod.v3/Matomo (= 0.0.1) was resolved to 0.0.1, which depends on
Pods/MatomoTracker/MatomoTracker (= 5.2.0)
None of your spec sources contain a spec satisfying the dependency: `Pods/MatomoTracker/MatomoTracker (= 5.2.0)`.
You have either:
* out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.) during validation.
Analyzed 1 podspec.
[!] The spec did not pass validation, due to 1 error.
this is my podspec:
Pod::Spec.new do |spec|
spec.name = 'TrackerPod.v3'
spec.version = '0.0.1'
spec.license = 'Copyright ****'
spec.homepage = 'https://*******8/TrackerPod/blob/master/README.md'
spec.author = { '****' => '****#****.com' }
spec.summary = 'Some description'
spec.source = { :git => '****', :tag => spec.version.to_s }
spec.source_files = 'TrackerPod.v3/*.{h,m, swift}'
spec.ios.deployment_target = '8.0'
spec.osx.deployment_target = '10.10'
spec.requires_arc = true
spec.swift_version = '4.0'
spec.xcconfig = { 'SWIFT_VERSION' => '4.1' }
spec.dependency 'MatomoTracker', '5.2.0'
spec.subspec 'Matomo' do |lib|
lib.dependency 'Pods/MatomoTracker/MatomoTracker', '5.2.0'
lib.source_files = 'Pods/MatomoTracker/MatomoTracker/**/*.{h,m,swift}'
end
end
and, this is a screenshot to show my project navigator.
You can see that MatomoTracker is nested 2 levels downs inside 'Pods'
the project navigator
Am using the right path to reference MatomoTracker Pods/MatomoTracker/MatomoTracker, it does not seem to find the pod Matomoto ?
Am I correct ?
to answer the question. I kind of know where the error stands.
In my podspec, I am using spec.dependency 'MatomoTracker', '~> 5.2'
without the above the line, the validation passes
it seems that a higher minimum deployment target is required. I have update to deployment target as 11.0 everywhere.
- Podfile
- build settings (pod target) in Xcode
- spec ios target as well in the pod spec
and, this is the error I get
ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code. You can use `--verbose` for more information.
ERROR | [OSX] unknown: Encountered an unknown error (CocoaPods could not find compatible versions for pod "MatomoTracker":
In Podfile:
TrackerPod.v3 (from `/Users/*****/Documents/projects/ios/libs/TrackerPod.v3`) was resolved to 0.0.1, which depends on
MatomoTracker (~> 5.2)
Specs satisfying the `MatomoTracker (~> 5.2)` dependency were found, but they required a higher minimum deployment target.) during validation.
Although I feel like I did by the book and as per the cocoapods guide, I am still missing sthg.
The MatomoTracker does not pass the validation
Related
Did anyone managed to integrate FBSDKCoreKit to a custom swift framework with cocoapods (or alternate method)?
When I do this (experiment 1):
target 'MyFramework' do
project 'MyFrameWork/MyFramework.xcodeproject'
pod 'FacebookSDK', :modular_headers => true
end
target 'MyApp' do
workspace 'MyWorkspace.xcworkspace'
project 'MyApp/MyApp.xcodeproj'
inherit! :complete
target :MyAppTests
target :MyAppUITests
end
I get No such module 'FBSDKCoreKit' when compiling the framework (same applies when setting modular_headers => false.
I have also tested use_frameworks! as follows: (experiment 2):
target 'MyFramework' do
project 'MyFrameWork/MyFramework.xcodeproject'
use_frameworks!
pod 'FacebookSDK'
end
target 'MyApp' do
workspace 'MyWorkspace.xcworkspace'
project 'MyApp/MyApp.xcodeproj'
inherit! :complete
target :MyAppTests
target :MyAppUITests
end
But then I get this error:
dyld: Library not loaded: #rpath/Bolts.framework/Bolts
Referenced from: /private/var/containers/Bundle/Application/***/MyApp.app/Frameworks/MyFramework.framework/MyFramework
Reason: image not found`.
Note: When I add the FacebookSDK to MyApp (with use_frameworks!) it works, but then, I can't make use of it from within MyFramework (hence useless to me).
I finally found another way to do that, so I dropped Cocoapods.
I stumbled upon the fact that Facebook publishes a Swift package (https://swiftpackageregistry.com/facebook/facebook-ios-sdk).
So I proceeded as follows:
removed pod 'FacebookSDK' from my pod file;
added the above mentioned package for my framework.
And voila!
Since Xcode 9 it is possible to use static libraries by omitting the use_frameworks! flag in the Podfile. However, when used with the Pod RealmSwift this results in the following error:
[!] The following Swift pods cannot yet be integrated as static libraries:
The Swift pod `RealmSwift` depends upon `Realm`, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.
Sadly, the proposed solution with use_modular_headers! does not work.
Other things I have tried include:
Using the latest Realm version (3.15.0)
Use the Objective C version and add Swift support, this won't build and give a module not found error in the RLMSupport.swift file .
Adding a bridging header for the Objective C version.
Endless clean, rebuild, Xcode relaunches and Derived Data folder cleaning.
It would not be preferable to circumvent CocoaPods and have this dependency be installed in a separate way, since that would make updating a more complex process. I hope there is a solution that works with CocoaPods, Realm and Swift.
I did the job doing following:
pod 'RealmSwift', '~> 3.17', :modular_headers => true
pod 'Realm', '~> 3.17', :modular_headers => true
As far as I can tell adding use_modular_headers! to top of Podfile works.
Adding s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } to .podspec doesn't work as far as I can tell. (Cocoapods 1.6.0-beta.2)
example:
target 'Opportunity' do
use_modular_headers!
end
I don't see why it wouldn't work. I got the same issue, and I added use_modular_headers! following way in the podfile and it worked.
target 'Pick Up Lines' do
use_modular_headers!
pod 'RealmSwift'
end
By the way, before doing any of it, make sure, you set the deployment target of the project as 11.0.
I can’t push a new version of my pod to the CocoaPods specs repository.
Running pod trunk push MyPod.podspec results in the following error:
[!] The Pod Specification did not pass validation.
The following validation failed:
- Warnings: Unrecognized `swift_version` key.
Here’s my podspec:
Pod::Spec.new do |spec|
spec.name = "MyPod"
spec.version = "0.1.1"
spec.summary = "[REDACTED]"
spec.homepage = "[REDACTED]"
spec.license = "Apache License, version 2"
spec.author = "[REDACTED]"
spec.social_media_url = "[REDACTED]"
spec.module_name = "MyPod"
spec.swift_version = "5.0"
spec.platform = :ios, "8.0"
spec.source = { :git => "https://github.com/[REDACTED].git", :tag => "v#{spec.version}" }
spec.source_files = "MyPod/**/*.{h,m,swift}"
end
What am I doing wrong?
I first noticed these errors before updating to Swift 5 and Xcode 10.2.
It seems to be a server-side bug. It’s been reported on GitHub.
However, since it’s a warning, not an error (despite it’s in red font color, which is confusing), it can be ignored with the --allow-warnings argument.
Summary, to update a pod:
Update the version and the tag in podspec beforehand
Commit, push code to git
Create new tag with the current code, make sure it's the same tag as the one in podspec
git tag 0.1.1
git push origin 0.1.1
Call pod spec lint to check and pod trunk push to update it on repo master list
pod lib lint YourSDK.podspec
pod trunk push YourSDK.podspec
It appears that your podfile is using the tag v0.1.1, however the tag in your repository is 0.1.1 without the v. This would also cause linting to fail.
I am setting up a Swift framework through CocoaPods.
Goals are:
Use a private repo for the Podspecs
Have the framework to be distributed as binary (as opposed to source code)
I've read already the CocoaPods frameworks, Making a CocoaPod plus other references (can't seem to be able to include more than 2 links with current SO reputation but I can point sources in comments).
The Podspec I am using is:
Pod::Spec.new do |s|
s.name = 'SDK'
s.version = '0.0.1'
s.summary = 'My SDK'
s.description = 'SDKs description'
s.homepage = 'https://github.com/XXX/sdk'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'XXX' => 'xxx#xxx.com' }
s.source = { :git => 'https://github.com/XXX/sdk.git', :tag => s.version.to_s }
s.ios.deployment_target = '8.0'
s.platform = :ios, '9.0'
s.source_files = 'SDK/Classes/**/*'
s.preserve_paths = 'Frameworks/SDK.framework'
s.ios.vendored_frameworks = 'Frameworks/SDK.framework'
end
The Pods xcode project was changed to build also i386 arch besides the standard (arm64, armv7).
This spec successfully validates locally with, provided that I copy the SDK.framework file to the /Frameworks folder in the .podspec folder:
pod lib lint
Issue: when I try to push the spec to the repo, the validation fails as the output below show:
pod repo push mySDKPrivateRepo SDK.podspec
Validating spec
-> SDK (0.0.1)
- ERROR | [iOS] file patterns: The `source_files` pattern did not match any file.
- ERROR | file patterns: The `preserve_paths` pattern did not match any file.
- ERROR | [iOS] file patterns: The `vendored_frameworks` pattern did not match any file.
[!] The `SDK.podspec` specification does not validate.
Questions:
How can I make the podspec validation successful when pushing it to repo?
Other notes:
Copying the SDK.framework to /Frameworks works manually.
If I include a Copy Files build step in the Pods Xcode project the file is not copied.
Using CocoaPods 1.1.0.
I was having a similar problem, the culprit was the project structure itself.
Be sure to check your at which directory you're pointing your source_files to. I've found that maintaining any kind of structure in this way is very difficult and it's easier to include all of your files in a single folder.
s.source_files = '<InsertName>/**/Classes/*'
Take a look at cocoapods advice on File Patters for some help on this.
By a process of elimination, I would suggest trying to push to the repo commenting out source_files in the podspec first, and work your way forward from there.
I am using cocoapods 0.39. I added Cocoa Touch Framework "MyFramework" as a separate target to my Swift project. The framework is using Firebase as a Cocoapod dependency. I am using MyFramework inside the the app. When I try to build the app I get multiple errors:
class … is implemented in both …/MyFramework.framework/MyFramework and …/MyApp.app/MyApp. One of the two will be used. Which one is undefined.
I understand what this error is about, but I am not able to fix it. If I remove Firebase from MyApp target then I can't use MyFramework inside the app as it depends on it. It looks like a common problem, but unfortunately I can't make it work.
My Podfile looks like this:
use_frameworks!
target 'MyApp' do
pod 'Firebase'
end
target 'MyAppTests' do
end
target 'MyFramework' do
pod 'Firebase'
end
target 'MyFrameworkTests' do
pod 'Firebase'
end
You are linking Firebase twice.
You can use inherit! :search_patchs directive in Podfile (requires Cocoapods 1.0 or higher) to let MyApp know about the dependencies without actually linking them:
use_frameworks!
target 'MyFramework' do
pod 'Firebase'
pod 'FirebaseAnalytics'
target 'MyApp' do
inherit! :search_paths
end
end
This requires that you explicitly declare dependencies in your Podfile to make them available in MyApp target. For example, adding pod 'Firebase' won't make using FirebaseAnalytics available in your application.
You can also convert MyFramework to a CocoaPod dependency and let CocoaPods handle the dependencies for you. To do this, create a Podspec file for your framework, like this:
Pod::Spec.new do |s|
# Meta data
s.name = "MyFramework"
s.version = "1.0.0"
s.platform = :ios
s.ios.deployment_target = '8.0'
s.summary = "-"
s.homepage = "-"
s.license = { :type => "MIT" }
s.author = { "Me" => "-" }
s.platform = :ios
s.ios.deployment_target = '8.0'
s.source = { :path => "MyFramework" }
# Source configuration
s.source_files = "MyFramework/**/*.swift"
s.resources = "MyFramework/**/*.{png,jpeg,jpg,storyboard,xib,strings}"
s.requires_arc = true
# Dependencies
# Firebase for iOS
s.dependency 'Firebase', '~> 3.0'
end
Then, you can add a development dependency to MyFramework in your application Podfile and remove Firebase dependency:
target 'MyApp' do
pod 'MyFramework', :path => '.'
end
Update . to the MyFramework.podspec location if needed.