validate fail when pushing AFNetworking to private cocoapods podspec - ios

I'm trying to add AFNetworking to the private cocoapods spec by following steps.
clone AFNetworking from github and push to private gitlab
modify AFNetworking.podspec file and change the s.source attribute to the private url
run pod spec lint --verbose, fail with
** BUILD SUCCEEDED **
Testing with xcodebuild. -> AFNetworking (3.2.1)
NOTE | [AFNetworking/Serialization, AFNetworking/Security, AFNetworking/Reachability, and more...] xcodebuild: note: Using new
build system
NOTE | [AFNetworking/Serialization, AFNetworking/Security, AFNetworking/Reachability, and more...] xcodebuild: note: Planning
build
NOTE | [AFNetworking/Serialization, AFNetworking/Security, AFNetworking/Reachability, and more...] xcodebuild: note:
Constructing build description
NOTE | [AFNetworking/Serialization, AFNetworking/Security, AFNetworking/Reachability, and more...] xcodebuild: warning: Skipping
code signing because the target does not have an Info.plist file. (in
target 'App')
ERROR | [AFNetworking/Serialization, AFNetworking/Security, AFNetworking/Reachability, and more...] xcodebuild: Returned an
unsuccessful exit code.
Analyzed 1 podspec.
[!] The spec did not pass validation, due to 1 error.
any guys know how to solve this issue?

Add AFNetworking pod name in your podspec file in dependency section.
s.dependency = 'AFNetworking, :path => ''

Solved my problem by running:
pod repo push MySpec AFNetworking.podspec --sources=MySpec,master --allow-warnings

Related

pod lib lint failed to validate a Kotlin multiplatform library

we are following the KMM documentation to build a very simple library available for our IOS and Android apps.
Following the sample project generated by android studio for a KMM library, we were able to install and intergrate manually the library built, in a IOS project.
Now we are trying to publish this library on cocoapod and make it available for installation.
The lib is called shared.. a shared.podspec is generated..
if we run
pod lib lint shared/shared.podspec --verbose
we have an error
`Testing with xcodebuild.
-> shared (0.3)
- WARN | url: The URL (https://github.com/OUR_REPO_URL) is not reachable.
- WARN | http: The URL (``) doesn't use the encrypted HTTPS protocol. It is crucial for Pods to be transferred over a secure protocol to protect your users from man-in-the-middle attacks. This will be an error in future releases. Please update the URL to use https.
- WARN | [iOS] license: Unable to find a license file
- ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code.
- NOTE | xcodebuild: note: Using new build system
- NOTE | xcodebuild: note: Using codesigning identity override: -
- NOTE | xcodebuild: note: Build preparation complete
- NOTE | [iOS] xcodebuild: note: Planning
- NOTE | [iOS] xcodebuild: note: Building targets in dependency order
- NOTE | [iOS] xcodebuild: warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')`
Scrolling up to the error I got:
`
/bin/sh -c /Users/andreadg/Library/Developer/Xcode/DerivedData/App-aamafucqqbvtfsfaselpdjormnrg/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/shared.build/Script-46EB2E000002E0.sh
REPO_ROOT="$PODS_TARGET_SRCROOT"
"$REPO_ROOT/../gradlew" -p "$REPO_ROOT" $KOTLIN_PROJECT_PATH:syncFramework -Pkotlin.native.cocoapods.platform=$PLATFORM_NAME -Pkotlin.native.cocoapods.archs="$ARCHS" -Pkotlin.native.cocoapods.configuration="$CONFIGURATION"
FAILURE: Build failed with an exception.
* What went wrong:
Directory '/' does not contain a Gradle build.
A Gradle build should contain a 'settings.gradle' or 'settings.gradle.kts' file in its root directory. It may also contain a 'build.gradle' or 'build.gradle.kts' file.
To create a new Gradle build in this directory run 'gradlew init'
`
Project structure below
enter image description here
Any idea?
also
pod repo push fails
we tried to publish the library manually ignoring the lint , and it installed with no errors but it fails later during the build of the ios project.
kdoctor doesn't give any error. All good.

pod spec lint validation fail : Unable to find matching .xcframework slice for the current build architectures (x86_64 i386)

I already have my framework in cocoapod, using xcframework with several framework inside :
ios-arm64
ios-arm64_x86_64-maccatalyst
ios-arm64_x86_64-simulator
tvos-arm64
tvos-arm64_x86_64-simulator
On my first push, I only put s.ios.deployment_target but forget s.tvos.deployment_target in my podspec. I edit the podspec file (updated s.version old was 1.0.0, new is 1.0.0-tvOS , adding s.tvos.deployment_target), commit and push on github, and create a tag with the same name as the version.
Pod::Spec.new do |s|
s.name = 'projectSwift'
s.version = '1.0.0-tvOS'
s.summary = 'summ'
s.description = 'descri'
s.homepage = 'http://homepage.com'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'author' => 'author#mmmail.com' }
s.source = { :git => 'linktogit', :tag => s.version }
s.vendored_frameworks = "projectSwift.xcframework"
s.ios.deployment_target = '10.2'
s.tvos.deployment_target = '9.0'
s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
end
When I try after to pod spec lint, it fail with this error :
pod spec lint --no-clean
Ignoring ffi-1.13.1 because its extensions are not built. Try: gem pristine ffi --version 1.13.1
-> projectSwift (1.0.0-tvOS)
- ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code. You can use `--verbose` for more information.
- NOTE | xcodebuild: note: Using new build system
- NOTE | xcodebuild: note: Building targets in parallel
- NOTE | xcodebuild: note: Using codesigning identity override: -
- NOTE | [iOS] xcodebuild: note: Planning build
- NOTE | [iOS] xcodebuild: note: Constructing build description
- NOTE | [iOS] xcodebuild: warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')
- NOTE | [iOS] xcodebuild: warning: [CP] Unable to find matching .xcframework slice in 'projectSwift/projectSwift.xcframework projectSwift framework ios-arm64 ios-arm64_x86_64-maccatalyst ios-arm64_x86_64-simulator' for the current build architectures (x86_64 i386).
- NOTE | xcodebuild: ld: warning: directory not found for option '-F/Users/adminlocal/Library/Developer/Xcode/DerivedData/App-bmhifwqmbbcfjnftngtmnjgbwkek/Build/Products/Release-iphonesimulator/XCFrameworkIntermediates/projectSwift'
- NOTE | xcodebuild: clang: error: linker command failed with exit code 1 (use -v to see invocation)
Pods workspace available at `/var/folders/_b/5v6y69j55cs0c_3fcw0cf5m80000gp/T/CocoaPods-Lint-20210316-13156-1ipai8f-projectSwift/App.xcworkspace` for inspection.
Analyzed 1 podspec.
[!] The spec did not pass validation, due to 1 error.
I didn't modify anything else than the podspec.

iOS file patterns: The `source_files` pattern did not match any file

I am trying to create a CocoaPod and when I try pod lib lint there's an error about ERROR | [iOS] file patterns: Thesource_filespattern did not match any file.
I am trying to follow BlinkingLabel pod as an example and using Gitlab for storage of my .git . I tagged it successfully 1.0.0 and it worked for it.
I used my CocoaPod in Example for Pod and its working but I got the error:
Ignoring unf_ext-0.0.7.5 because its extensions are not built. Try: gem pristine unf_ext --version 0.0.7.5
-> BlinkingLabel (1.0.0)
- ERROR | [iOS] file patterns: The `source_files` pattern did not match any file.
- NOTE | xcodebuild: note: Using new build system
- NOTE | [iOS] xcodebuild: note: Planning build
- NOTE | [iOS] xcodebuild: note: Constructing build description
- NOTE | [iOS] xcodebuild: warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')
[!] BlinkingLabel did not pass validation, due to 1 error.
You can use the `--no-clean` option to inspect any issue.
My source_file prop is:
s.source_files = 'BlinkingLabel/Classes/**/*'
But I've tried it with:
s.source_files = "BlinkingLabel/**/*"
s.source_files = 'BlinkingLabel/BlinkingLabel.swift'
s.source_files = 'BlinkingLabel/Classes/**/*.{h,m,c}'
No one has worked for me in lint.
And there's a strange thing.
In the article and examples it recommended to use with BlinkingLabel/Classes/**/* but there's nothing any directory as named Classes in BlinkingLabel, I guess because of new update of CocoaPod or maybe something is different in new CocoaPod. Can you explain this?
And how to solve this problem for pod lib lint at all?
Edit: I've searched over stackoverflow but nothing work for me.
Thanks in advance.
For anyone who stuck at - ERROR | [iOS] file patterns: Thesource_filespattern did not match any file., do not use source_files like below.
s.source_files = 'BlinkingLabel/Classes/**/*'
Use it with your inner directory name and exact file type.
For example if you have a Handler.swift file it must be.
s.source_files = 'Classes/**/*.swift'
If you have any .c file in your pod project that used
s.source_files = 'Classes/**/*.c'
or you can mix it with different file types.
Further I realized that the you must not trust to Classes directory.
You can create a Sources directory and can add all your source files into it and then you can try it with
s.source_files = 'Sources/**/*.swift'
This is the exact solution for me.
I hope it helps for anyone who stuck at.
I regret to ask the question.
It worked now.
s.source_files = 'BlinkingLabel/Classes/**/*'
I've not changed anything but it worked. That's strange.
You need to make sure that you have your files and source_files is appointed to that folder, and then check lint locally
pod lib lint YPlayer.podspec
if all ok, then you can push to cocoapods
pod trunk register email#domain.com 'Your Name' --description='Senior ios developer'
pod trunk push YPlayer.podspec
if it that failed again because of source_files then you need to make new tag, and need to push podspec file and your code relatively, because pod trunk push will check your your code using tag on git not locally like pod lib lint YPlayer.podspec

Unable to read the license file LICENSE.txt - Creating a cocoapod

I am trying to create a cocoapod and I keep getting this error:
Unable to read the license file `LICENSE.txt` for the spec
'WhiteFlowerFactory (0.0.1)'
My podspec code:
spec.name = "WhiteFlowerFactory"
spec.version = "0.0.1"
spec.license = { :type => "MIT", :file => "LICENSE.txt" }
spec.source_files = "WhiteFlowerFactory/*.{swift}"
spec.platform = :ios
spec.ios.deployment_target = '11.0'
spec.swift_version = "5.0"
And here is where it appears in my project directory:
What I have tried:
Moving the LICENSE.txt file to the second "WhiteFlowerFactory" subdirectory
Renamed to LICENSE.md
Renamed to LICENSE (no extension)
No matter what, I continually receive the same error.
I am also getting a separate error, and I am not sure if this error is related, but I will add it here just in case:
[iOS] unknown: Encountered an unknown error (Could not find a `ios`
simulator (valid values: ). Ensure that Xcode -> Window -> Devices has
at least one `ios` simulator listed or otherwise add one.) during
validation.
I've had both of these errors for several hours. I deleted Xcode 10.2 and 11.0 beta and all simulators and derived data and just freshly reinstalled Xcode 10.3 and its simulators. Still receiving both errors.
Edit: Just updated from cocoapods 1.6.1 -> 1.7.5, second error is solved, still receiving the license error:
Validating spec
-> WhiteFlowerFactory (0.0.1)
- WARN | [iOS] license: Unable to find a license file
- NOTE | xcodebuild: note: Using new build system
- NOTE | [iOS] xcodebuild: note: Planning build
- NOTE | [iOS] xcodebuild: note: Constructing build description
[!] The `WhiteFlowerFactory.podspec` specification does not validate.
[!] Unable to read the license file `LICENSE.txt` for the spec `WhiteFlowerFactory (0.0.1)`
The podspec should include a source field that describes the location of the source. See docs here. Typically it describes a github repo along with a version based tag that has been pushed to that repo.
I had same issue, but my LICENSE file had no extension. So I've removed extension in podspec and it works
s.license = { :type => 'MIT', :file => 'LICENSE' }

Xcode Swift CocoaPods pod spec lint Fails on Embed Pods Frameworks

I'm getting the following error when trying to run pod spec lint --verbose:
sent 1312397 bytes received 106 bytes 2625006.00 bytes/sec
total size is 1311832 speedup is 1.00
/var/folders/3d/v0m_90ty4mg1opbynpnjjvzh2010gm/T/CocoaPods-Lint-20181015-62030-oljqd-MySwiftPackage/Pods/Target Support Files/Pods-App/Pods-App-frameworks.sh: line 104: EXPANDED_CODE_SIGN_IDENTITY: unbound variable
Command PhaseScriptExecution failed with a nonzero exit code
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/myuser/Library/Developer/Xcode/DerivedData/App-loplmnuztwibrzfqgadqoxucytrz/Build/Intermediates.noindex/App.build/Release/App.build/Script-09EB8340PON5K18DNW0C63DQ.sh
(1 failure)
Testing with `xcodebuild`.
-> MySwiftPackage (0.1.0)
- WARN | summary: The summary is not meaningful.
- WARN | description: The description is shorter than the summary.
- WARN | url: The URL (https://github.com/fishcharlie/MySwiftPackage) is not reachable.
- NOTE | xcodebuild: note: Using new build system
- NOTE | xcodebuild: note: Planning build
- NOTE | xcodebuild: note: Constructing build description
- NOTE | [iOS] xcodebuild: warning: Skipping code signing because the target does not have an Info.plist file. (in target 'App')
- WARN | xcodebuild: MySwiftPackage/MySwiftPackage/ViewControllers/Shared/MyFirstViewController.swift:102:37: warning: conditional cast from 'UIViewController' to 'MyViewController' (aka 'UIViewController') always succeeds
- WARN | xcodebuild: MySwiftPackage/MySwiftPackage/ViewControllers/Shared/MySecondViewController.swift:145:37: warning: conditional cast from 'UIViewController' to 'MyViewController' (aka 'UIViewController') always succeeds
- ERROR | [OSX] xcodebuild: Returned an unsuccessful exit code.
Analyzed 1 podspec.
[!] The spec did not pass validation, due to 1 error and 5 warnings.
I know I have a few warnings that I can clean up. But there is only one error that I'm getting, which is - ERROR | [OSX] xcodebuild: Returned an unsuccessful exit code.. And above that it says that Embed Pods Frameworks was the cause of failure.
Not quire sure how to debug this since I can build and run the example projects in Xcode just fine.
Below I have attached my Podspec as well.
Pod::Spec.new do |s|
s.name = 'MySwiftPackage'
s.version = '0.1.0'
s.summary = 'A short description of MySwiftPackage.'
s.description = <<-DESC
TODO: Add long description of the pod here.
DESC
s.homepage = 'https://github.com/fishcharlie/MySwiftPackage'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'fishcharlie' => 'fishcharlie.code#gmail.com' }
s.source = { :git => 'https://github.com/fishcharlie/MySwiftPackage.git', :tag => s.version.to_s }
s.social_media_url = 'https://twitter.com/char_fish'
s.ios.deployment_target = '9.0'
s.osx.deployment_target = '10.11'
s.swift_version = '4.2'
s.source_files = 'MySwiftPackage/Classes/**/*', 'MySwiftPackage/ViewControllers/Shared/**/*'
s.ios.source_files = 'MySwiftPackage/ViewControllers/iOS/**/*'
s.osx.source_files = 'MySwiftPackage/ViewControllers/macOS/**/*'
s.resources = 'MySwiftPackage/Assets/**/*.{ttf,xcassets}'
s.dependency 'Alamofire', '4.7.3'
s.dependency 'Bond', '6.10.2'
s.ios.dependency '1PasswordExtension', '1.8.5'
end
Any ideas on how to fix/debug this?
The error should be about
line 104: EXPANDED_CODE_SIGN_IDENTITY: unbound variable
The solution (as stated in Issue 7708 on github/Cocoapods ) should be to add the following User-Defined Settings to project:
EXPANDED_CODE_SIGN_IDENTITY="-"
EXPANDED_CODE_SIGN_IDENTITY_NAME="-"`
Try adding the flag --no-clean. This flag makes lint leave the build directory
intact for inspection
so you can debug that build failure in a workspace which may be more familiar and give you more information.
Looks like they fixed this for xcode 10 in pr github.com/CocoaPods/CocoaPods/pull/7720, you could try upgrading to 1.6.0, or downgrading xcode to 9.4.

Resources