問題描述
發(fā)布私有庫時(shí)用僧,如果庫支持arch i386/x86_64歹叮,在執(zhí)行pod spec lint ...
或者直接執(zhí)行pod repo push ...
時(shí)寓涨,通常會報(bào)下面的錯(cuò)誤澎蛛,部分terminal信息如下:
The following build commands failed:
Ld /Users/someone/Library/Developer/Xcode/DerivedData/App-gavlycpgugozzpabewwnvvizmsua/Build/Intermediates.noindex/App.build/Release-iphonesimulator/App.build/Objects-normal/x86_64/App normal x86_64
(1 failure)
Testing with `xcodebuild`.
-> sdk_release (1.0.0)
- ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code.
- 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. (in target 'App')
- NOTE | [iOS] xcodebuild: clang: error: linker command failed with exit code 1 (use -v to see invocation)
......
[!] The `sdk_release.podspec` specification does not validate.
引起的原因
可參考
https://github.com/CocoaPods/CocoaPods/issues/5854
https://github.com/CocoaPods/CocoaPods/issues/5472
https://stackoverflow.com/questions/36618252/cocoapods-podspec-push-without-build-simulator-architecture
解決方案
一 追加option --skip-import-validation
pod repo push privSpecs xxxxxx.podspec --allow-warnings --skip-import-validation
pod spec lint xxxxxx.podspec --skip-import-validation
--skip-import-validation
的描述可參見
https://guides.cocoapods.org/terminal/commands.html#pod_spec_lint
二修改validator.rb
在本地Cocoapods的安裝目錄下找到文件validator.rb
終端執(zhí)行
gem which cocoapods
返回cocoapods.rb文件的路徑
/Users/XXXXXX/.rvm/gems/ruby-2.3.0/gems/cocoapods-1.5.3/lib/cocoapods.rb
在和cocoapods.rb同級的目錄下存在Folder "/cocoapods/"宗兼,validator.rb即在它里面躏鱼。
MacBook-Pro:cocoapods user$ ls
command gem_version.rb sandbox
command.rb generator sandbox.rb
config.rb hooks_manager.rb sources_manager.rb
core_overrides.rb installer target
downloader installer.rb target.rb
downloader.rb open-uri.rb user_interface
executable.rb project.rb user_interface.rb
external_sources resolver validator.rb
external_sources.rb resolver.rb
打開validator.rb,找到驗(yàn)證方法xcodebuild(action, scheme, configuration)
的調(diào)用方法注掉即可
def xcodebuild(action, scheme, configuration)
require 'fourflusher'
command = %W(clean #{action} -workspace #{File.join(validation_dir, 'App.xcworkspace')} -scheme #{scheme} -configuration #{configuration})
case consumer.platform_name
when :osx, :macos
command += %w(CODE_SIGN_IDENTITY=)
when :ios
command += %w(CODE_SIGN_IDENTITY=- -sdk iphonesimulator)
command += Fourflusher::SimControl.new.destination(:oldest, 'iOS', deployment_target)
when :watchos
command += %w(CODE_SIGN_IDENTITY=- -sdk watchsimulator)
command += Fourflusher::SimControl.new.destination(:oldest, 'watchOS', deployment_target)
when :tvos
command += %w(CODE_SIGN_IDENTITY=- -sdk appletvsimulator)
command += Fourflusher::SimControl.new.destination(:oldest, 'tvOS', deployment_target)
end
# 注掉此處代碼
# begin
# _xcodebuild(command, true)
# rescue => e
# message = 'Returned an unsuccessful exit code.'
# message += ' You can use `--verbose` for more information.' unless config.verbose?
# error('xcodebuild', message)
# e.message
# end
end