Unable to Create Cocoapod dependency with remote framework - ios

I want to create a Cocoapod dependency with a existing framework(A Compiled framework for internal uses which I want to share internally via cocoapods) which is in remote location such as git and drop box.
I am following the Tutorial
Below is the code of podspec file
Pod::Spec.new do |s|
s.name = 'SDK101'
s.version = '0.1.0'
s.summary = 'A Awesomeness of SDK101.'
s.description = <<-DESC
Add long description of the pod here.Awesomeness!!!
DESC
s.homepage = 'https://github.com/'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'Sourabh' => 'sourabh.gajbhiye#gmail.com' }
s.source = { :http => 'https://app.box.com/s/ipwollwlh675fkg3oy87rr7nneafafv0', :type => 'zip' }
s.ios.deployment_target = '12.0'
s.platform = :ios
s.ios.vendored_frameworks = 'SDK101.framework'
s.exclude_files = "Classes/Exclude"
end
for this file when i am executing the following command in terminal for the validation of pod I am getting error shown below
pod spec lint --verbose
[!] Error installing SDK101
-> SDK101 (0.1.0)
- ERROR | [iOS] unknown: Encountered an unknown error ([!] /usr/bin/unzip /var/folders/gq/xrq80ysd50nd5frn2zhb89dc0000gn/T/d20210422-75411-1bv4xo/file.zip -d /var/folders/gq/xrq80ysd50nd5frn2zhb89dc0000gn/T/d20210422-75411-1bv4xo
Archive: /var/folders/gq/xrq80ysd50nd5frn2zhb89dc0000gn/T/d20210422-75411-1bv4xo/file.zip
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of /var/folders/gq/xrq80ysd50nd5frn2zhb89dc0000gn/T/d20210422-75411-1bv4xo/file.zip or
/var/folders/gq/xrq80ysd50nd5frn2zhb89dc0000gn/T/d20210422-75411-1bv4xo/file.zip.zip, and cannot find /var/folders/gq/xrq80ysd50nd5frn2zhb89dc0000gn/T/d20210422-75411-1bv4xo/file.zip.ZIP, period.
Analyzed 1 podspec.
[!] The spec did not pass validation, due to 1 error.
After this I followed Cocoapods error installing libopencv-contrib but it didn't helped me.
Please help me what I am doing wrong?

Related

Why do I get a ld:framework not found <frameworkName> build error during pod repo push?

I have a framework that I've built for iOS, dynamic framework with a Universal binary for x86_64 (iosSimulator), arm64 and arm64e.
The framework works fine when I drag it to an app and use it.
Pod repo push works fine when I use a repo on my machine that holds the framework and another specs repo that's on my machine. I created the repos with git init --bare
When I use github and point the spec to the github repo instead of my local repo it fails with ld:framework not found <frameworkName> . When I skip validation and push and and finally use it in an app using the pod file I get the same error, ld:framework not found <frameworkName>.
The only difference is I've moved from my local git repo that holds the framework to one on Github.
Edit:
Pasting podspec below
Pod::Spec.new do |s|
s.name = "frameworkName"
s.version = "0.51.0"
s.summary = "A brief description of frameworkName project."
s.description = <<-DESC
An extended description of frameworkName project.
DESC
s.homepage = "http://your.homepage/here"
s.license = { :type => 'Copyright', :text => <<-LICENSE
Copyright 2018
Permission is granted to...
LICENSE
}
s.author = { "myname" => "" }
s.source = { :git => "<git hub repo>", :tag => "#{s.version}", :branch => "iOS_Framework" }
s.ios.vendored_frameworks = "frameworkName.framework"
s.vendored_frameworks = "frameworkName.framework"
s.ios.deployment_target = '12.0'
s.pod_target_xcconfig = { 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' }
s.user_target_xcconfig = { 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' }
end
It ended up being a case sensitivity problem. The framework on the repo was named frameworkName.Framework instead of frameworkName.framework. Worked after I changed it.
Not sure why there wasn't an issue with a local git repo.

Pod Repo Push not working in iOS

I have created sample CocoaPod file and it worked successfully, now on final stage when I am doing Pod Repo Push it showing me error. Below are the command and error which I am getting.
Pod::Spec.new do |s|
s.name = "IDFVSample"
s.version = "1.0.0"
s.summary = "A short description of VFIDOneFramework. Please check this awesome work from me you will like it"
s.description = "This is the best tutorial. Recently given presentation in the world great forum for the member."
s.homepage = "https://github.com/kashiftriffort/IDFVSample"
s.license = "MIT"
s.author = { "KJilani" => "Kashif.triffort#gmail.com" }
s.platform = :ios, "9.0"
s.source = { :git => "https://github.com/kashiftriffort/IDFVSample.git", :tag => "1.0.0" }
s.source_files = "IDFVSample/IDFVSample/IDFVSample.swift"
s.dependency 'Firebase/Core'
end
pod repo push IDFVPodSpecs IDFVSample.podspec --allow-warnings
Validating spec
Cloning spec repo `-1` from ``
[!] Unable to add a source with url `` named `-1`.
You can try adding it manually in `~/.cocoapods/repos` or via `pod repo add`.
Looks like you have not added the repo containing your specs yet.
Do something like:
pod repo add IDFVSample <git source>
Move your IDFVSample.podspec to the root of your repository(where is already located LICENSE and README files)

Conflicts with FlutterFire and native GeoFire plugin on iOS

I'm getting an error when I'm trying to add GeoFire to my iOS Flutter project which has the FlutterFire Database plugin included. This is what the error looks like:
Resolving dependencies of `Podfile`
[!] Unable to satisfy the following requirements:
- `Firebase (~> 2.1)` required by `GeoFire (1.1.0)`
Specs satisfying the `Firebase (~> 2.1)` dependency were found, but they required a higher minimum deployment target.
My podspec file looks like this atm:
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'geofire'
s.version = '0.0.1'
s.summary = 'A new flutter plugin project.'
s.description = <<-DESC
A new flutter plugin project.
DESC
s.homepage = 'http://example.com'
s.license = { :file => '../LICENSE' }
s.author = { 'Your Company' => 'email#example.com' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter'
s.dependency 'GeoFire', '>= 1.1' # Adding GeoFire
s.ios.deployment_target = '8.0'
end
I also tried using the git page in to add Geofire in my podspec file as suggested here: GeoFire giving problems with CocoaPods
s.dependency 'GeoFire', :git => 'https://github.com/firebase/geofire-objc.git'
Is there a (simple) solution for this?
I faced the same kind of issue few days ago.
I think I fixed it by doing the following steps:
Run the command 'pod repo update' (it will update your repo information)
Then run the command 'pod update' (it will update your pods using the latest repo information)
Let me know if this is solving your issue :)
Please try the approach suggested by Bjørn Børresen here:
Since Flutter kind of abstracts away this Cocoapods process. Here's what I did to be able to run "pod repo / update":
Run pod repo update
Set the environment variable FLUTTER_FRAMEWORK_DIR to something that looks like /Users/youruser/bin/flutter/bin/cache/artifacts/engine/ios/. You can do a locate Flutter.podspec to find this directory
From YourFlutterProject/ios run pod update
After this you should be able to run your app again

Building a Cocoapod with both Swift and Objective-C: How to Deal with Umbrella Header Issues?

I have an existing Xcode framework, that uses both Swift and Objective-C, that I'm trying to get working as a Cocoapod. My steps so far are:
1) I used pod lib create SMCoreLib to initialize a new folder (https://guides.cocoapods.org/making/using-pod-lib-create.html).
2) I copied the Swift and Objective-C code from my framework into the SMCoreLib/Classes folder in this newly initialized pod folder. I also dragged this code into the relevant group in _Pods.xcodeproj.
3) I made some changes to the .podspec file for my project. It's as follows (note that the Github repo hasn't been updated yet with these changes; I can do that if someone wants):
Pod::Spec.new do |s|
s.name = 'SMCoreLib'
s.version = '0.0.2'
s.summary = 'Spastic Muffin Core Library for iOS'
# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!
s.description = <<-DESC
Objective-C and Swift classes to support Spastic Muffin code.
DESC
s.homepage = "https://github.com/crspybits/SMCoreLib.git"
s.license = { :type => "GPL3", :file => "LICENSE.txt" }
s.author = { "Christopher Prince" => "<snip>" }
s.platform = :ios, "8.0"
s.source = { :git => "https://github.com/crspybits/SMCoreLib.git", :tag => "#{s.version}" }
s.ios.deployment_target = '8.0'
s.source_files = 'SMCoreLib/Classes/**/*'
s.resources = "SMCoreLib/Assets/**"
# s.resource_bundles = {
# 'SMCoreLib' => ['SMCoreLib/Assets/*.png']
# }
# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
# s.dependency 'AFNetworking', '~> 2.3'
s.requires_arc = true
# s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
s.dependency 'AFNetworking'
s.dependency 'HPTextViewTapGestureRecognizer', '~> 0.1'
s.dependency 'Reachability'
end
My problem is that I get failures both trying to build the Example Xcode project and trying to lint the pod. Building the Example Xcode project, I get the following errors:
From the command line, when I do:
pod lib lint --allow-warnings --verbose --no-clean
I get the following errors:
- NOTE | [iOS] xcodebuild: <module-includes>:2:9: note: in file included from <module-includes>:2:
- ERROR | [iOS] xcodebuild: /Users/chris/Library/Developer/Xcode/DerivedData/App-bhqthebvswpzxeesjidsqpmmwovu/Build/Products/Release-iphonesimulator/SMCoreLib/SMCoreLib.framework/Headers/SMCoreLib-Swift.h:103:9: error: 'SMCoreLib/SMCoreLib.h' file not found
- NOTE | [iOS] xcodebuild: <unknown>:0: error: could not build Objective-C module 'SMCoreLib'
The problem appears to be that in the automatically generated SMCoreLib-Swift.h Generated Interface Header, the SMCoreLib.h umbrella header cannot be found. I would greatly appreciate any suggestions.
I have a hack fix for this problem. I'd like a better one. The fix is to put a SMCoreLib.h file at: SMCoreLib/Classes/SMCoreLib.h. The file contains the single line:
#import "SMCoreLib-umbrella.h"
The problem seems to be that the Generated Interface Header doesn't respect a name change for the umbrella header given in a module map. Cocoapods creates this module map and the name change. This hack fix is present in the Git repo for this project https://github.com/crspybits/SMCoreLib.git.

pod spec lint fails with 400

I followed all the steps from https://guides.cocoapods.org/making/using-pod-lib-create to make my openSource library available on cocoapds.
At the end of the steps before publishing run pod lib lint command and it passed the test:
-> SHMultipleSelect (0.1.0)
SHMultipleSelect passed validation.
But pod spec lint command giving some error:
[!] /usr/bin/git clone https://github.com/<GITHUB_USERNAME>/SHMultipleSelect.git /var/folders/fn/49fp5hx941541w0ncv5n28_h0000gn/T/d20150723-39741-1esoisq --single-branch --depth 1 --branch 0.1.0
Cloning into '/var/folders/fn/49fp5hx941541w0ncv5n28_h0000gn/T/d20150723-39741-1esoisq'...
fatal: unable to access 'https://github.com/<GITHUB_USERNAME>/SHMultipleSelect.git/': The requested URL returned error: 400
Searched error through stackoverflow and found this Can not update my pod library.
Run pod spec lint SHMultipleSelect.podspec command as accepted answer says and it gived me another error:
[!] /usr/bin/git clone https://github.com/Shamsiddin/SHMultipleSelect.git /var/folders/fn/49fp5hx941541w0ncv5n28_h0000gn/T/d20150723-39842-774kfl --single-branch --depth 1 --branch 0.1.0
Cloning into '/var/folders/fn/49fp5hx941541w0ncv5n28_h0000gn/T/d20150723-39842-774kfl'...
warning: Could not find remote branch 0.1.0 to clone.
fatal: Remote branch 0.1.0 not found in upstream origin
Unexpected end of command stream
Not clear to solve my problem. Can someone show me rote where to go?
Here's my librarys Git url: https://github.com/Shamsiddin/SHMultipleSelect
And my library's .podspec file:
#
# Be sure to run `pod lib lint SHMultipleSelect.podspec' to ensure this is a
# valid spec and remove all comments before submitting the spec.
#
# Any lines starting with a # are optional, but encouraged
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = "SHMultipleSelect"
s.version = "0.1.0"
s.summary = "An easy-to-use multiple selection view."
s.description = <<-DESC
An easy-to-use multiple selection view for iOS 7+.
DESC
s.homepage = "https://github.com/Shamsiddin/SHMultipleSelect"
# s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2"
s.license = 'MIT'
s.author = { "Shamsiddin" => "shamsiddin.saidov#gmail.com" }
s.source = { :git => "https://github.com/Shamsiddin/SHMultipleSelect.git", :tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/Shamsiddin_Said'
s.platform = :ios, '7.0'
s.requires_arc = true
s.source_files = 'Pod/Classes/**/*'
s.resource_bundles = {
'SHMultipleSelect' => ['Pod/Assets/*.png']
}
# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
# s.dependency 'AFNetworking', '~> 2.3'
end
EDIT 1:
It turns out i didn't create a tag at my Github repo. I created tag with the version 0.1.0 and run pod spec lint SHMultipleSelect.podspec command again. Now it's giving me another error:
-> SHMultipleSelect (0.1.0)
- ERROR | [iOS] The `source_files` pattern did not match any file.
Analyzed 1 podspec.
[!] The spec did not pass validation, due to 1 error.
EDIT 2:
Added screenshot from my projects structure:
EDIT 3:
Added screenshot from my project's structure on disc. The structure is created using pod lib create SHMultipleSelect command
Glad to help with your initial problem. Regarding your edited question, it seems there are no files at 'Pod/Classes/**/*'. This file path should be specified relative to the pod spec and should contain files. Is there a folder called Pod in the same folder as your podspec?

Resources