CocoaPods podspec lint failure - file not found - ios

I'm trying to distribute my pod, but I'm having issues with it's validation.
When I'm trying to lint against my .podspec I'm getting:
- ERROR | [iOS] [xcodebuild] path/to/my/source/file.m:14:9: fatal error: 'KeyValueObjectMapping/DCKeyValueObjectMapping.h' file not found
I tried to preserve the path to their framework with different variations like
s.preserve_paths = 'KeyValueObjectMapping.framework/*'
or
s.preserve_paths = '${PODS_ROOT}/Vendor/KeyValueObjectMapping/KeyValueObjectMapping.framework'
& other variations but that way I'm getting one more error:
- ERROR | [iOS] The `preserve_paths` pattern did not match any file.
I also tried different other things which I saw on other issues like:
s.xcconfig = { 'HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/Vendor/KeyValueObjectMapping/KeyValueObjectMapping.framework"','FRAMEWORK_SEARCH_PATHS' => '"$(PODS_ROOT)/Vendor/KeyValueObjectMapping/*"' }
s.framework = 'KeyValueObjectMapping'
The project builds fine with Xcode5 & with xcodebuild with it's default setup, I'm getting this issue only when validating it for Cocoapods.

I was running into this issue trying to create a custom Podspec and add the RevMob and Heyzap SDKs as dependencies.
I kept getting the following error:
- ERROR | [iOS] [xcodebuild] MyProject/MyProjectSubDir/AnotherDir/CustomAd.h:10:9: fatal error: 'RevMobAds/RevMobAds.h' file not found
- ERROR | [iOS] [xcodebuild] MyProject/MyProjectSubDir/AnotherDir/FacebookController.m:18:9: fatal error: 'RevMobAds/RevMobAds.h' file not found
Then when I specified the FRAMEWORK_SEARCH_PATHS for RevMob, I would get the same error but for Heyzap's SDK.
The solution for me was to create a subspec and specify search paths for each of the SDKs giving me issues. Here:
s.subspec "Heyzap" do |ss|
ss.dependency "Heyzap", "~> 6.4.4"
ss.xcconfig = { "FRAMEWORK_SEARCH_PATHS" => "$(PODS_ROOT)/Heyzap"}
end
s.subspec "RevMob" do |ss|
ss.dependency "RevMob", "~> 7.4.8"
ss.xcconfig = { "FRAMEWORK_SEARCH_PATHS" => "$(PODS_ROOT)/RevMob"}
end
My pod spec lint now runs & builds without error.

Related

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

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.

XMPPFramework in podspec

Previously, I integrated XMPPFramework by using dependencies in podspec: s.dependency 'XMPPFramework', '3.6.6'
I'm aware that in order to fix the error of 'Redefinition of module dnssd'. We should pod directly from the master branch:
pod 'XMPPFramework', :git => "https://github.com/robbiehanson/XMPPFramework.git", :branch => 'master'
Unfortunately, we cannot use dependencies without version, so I commented the dependency out and used pull XMPPFramework using podfile. I fixed some minor issues and was able to build the app, but when I tried to do pod spec lint I got the following error:
- NOTE | xcodebuild: PHMessaging/PHMessaging/Classes/PHMessagingManager.h:20:9: fatal error: 'XMPP.h' file not found - NOTE | xcodebuild: PHMessaging/PHMessaging/Classes/PHBasicConversationViewController.h:10:9: fatal error: 'XMPPFramework/XMPPUser.h' file not found
I've already raised the issue with CocoaPods on GitHub, and #BenAsher44 suggested to create a private specs repo and add it to the dependencies in my podspec. This didn't seem to work. Are there any other ways?

Creating CocoaPod, get error I can't solve about missing file (that is there)

I am trying to create a pod (first one) for this project:
https://github.com/xeppen/GLLingoManager
I run $ pod spec lint GLLingoManager.podspec and I get an error.
-> GLLingoManager (0.1.0)
- ERROR | xcodebuild: Returned an unsuccessful exit code.
- NOTE | xcodebuild: GLLingoManager/Classes/GLLingoManager.m:10:9: fatal error: 'GLNetworkService.h' file not found
I am checking the files and all seem correct. Demo project works etc.
How can I solve this? I dont understand why it says its wrong.
If you use SDK, I think you need to create subspec and specify search paths for each of the SDK may giving issues, for example :
s.subspec "Kairos" do |ss|
ss.dependency "Kairos", "~> 2.1"
ss.xcconfig = { "FRAMEWORK_SEARCH_PATHS" => "$(PODS_ROOT)/Heyzap"}
end

Error using Apple frameworks in my CocoaPod podspec?

I have a cross platform library that I'm trying to push to CocoaPod, but the it is failing on the podspec validation. The error I get is:
ERROR | xcodebuild: Returned an unsuccessful exit code. You can use --verbose for more information.
ERROR | xcodebuild: MyPod/Sources/CLKComplicationServer.swift:10:8: error: no such module 'ClockKit'
I tried adding the frameworks to my podspec, but it is still not accepting. Here is what my podspec looks like:
Pod::Spec.new do |s|
...
s.ios.deployment_target = "8.4"
s.watchos.deployment_target = "2.0"
s.tvos.deployment_target = "9.0"
s.requires_arc = true
s.ios.framework = 'AVFoundation'
s.watchos.framework = 'ClockKit'
s.source_files = "Sources/**/*.{h,swift}"
end
What am I doing wrong? I'm having the same issue with AVFoundation. I tried adding both to my header file, but ClockKit is not recognized.

Resources