如何配置cocoapods以便在 ProjectName 检查目标成员资格的故事板中运行 pod install ?
我有一个由我公司创建的框架和应用程序。我们使用Artifactory和Cocoapods来部署框架并将其拉入应用程序。该框架包含一个故事板,然后应用程序使用该故事板呈现表单。我正在使用XCode 8
由' pod安装'
创建的Pod目标问题是通过运行' pod安装'创建的目标。必须手动更新。
框架中的故事板仅为ProjectName-ProjectName检查目标成员身份。如果我运行应用程序,我会得到以下异常:
***由于未捕获的异常终止应用' NSInvalidArgumentException',原因:'无法找到名为' ProjectName'的故事板在捆绑NSBundle ......
let bundle = NSBundle.init(forClass: ProjectNameViewController.classForCoder())]
let storyboard = UIStoryboard(name: "ProjectName", bundle: bundle)
如果我手动转到故事板并检查ProjectName的目标成员资格,则按预期工作。
用于部署框架
Pod::Spec.new do |spec|
spec.name = 'ProjectName'
spec.version = '0.3.1'
spec.license = { :type => "MIT", :file => "LICENSE" }
spec.summary = 'Summary.'
spec.homepage = 'http://COMPANYWEBSITE'
spec.authors = 'Author'
spec.source = { :git => 'https://github.com/ProjectName.git',
:tag => spec.version.to_s, :submodules => true }
spec.requires_arc = true
spec.ios.deployment_target = '8.2'
spec.framework = 'Foundation, UIKit'
spec.source_files = 'ProjectName/**/*.{swift}'
spec.resource_bundle = { 'ProjectName' => ['ProjectName/Resources/**/*'] }
end
用于将框架拉入app
use_frameworks!
plugin 'cocoapods-art', :sources => [
'companyname-public'
]
target 'ProjectNameTest' do
pod 'ProjectName'
end
答案 0 :(得分:7)
我能够通过改变来解决这个问题:
spec.resource_bundle = { 'ProjectName' => ['ProjectName/Resources/**/*'] }
到
spec.resources = 'ProjectName/Resources/**/*'