CocoaPods podspec lint failure
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.