ios – Pod安装需要取消选中目标成员资格

前端之家收集整理的这篇文章主要介绍了ios – Pod安装需要取消选中目标成员资格前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

如何配置cocoapods以便在故事板中运行pod install导致ProjectName检查目标成员身份?

背景

我有一个框架和一个应用程序,都是由我的公司创建的.我们使用Artifactory和Cocoapods来部署框架并将其拉入应用程序.该框架包含一个故事板,然后应用程序使用该故事板呈现表单.我正在使用XCode 8

‘pod install’创建的Pod目标

> ProjectName
> ProjectName-ProjectName
> Pods-ProjectNameTest

问题

问题是必须手动更新通过运行“pod install”创建的目标.

框架中的故事板仅为ProjectName-ProjectName检查目标成员身份.如果我运行应用程序,我会得到以下异常:

*** Terminating app due to uncaught exception ‘NSInvalidArgumentException’,reason: ‘Could not find a storyboard named ‘ProjectName’ in bundle NSBundle…

调用代码

let bundle = NSBundle.init(forClass: ProjectNameViewController.classForCoder())]
let storyboard = UIStoryboard(name: "ProjectName",bundle: bundle)

解决方法

如果我手动转到故事板并检查ProjectName的目标成员身份,则按预期工作.

podspec

用于部署框架

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

Podfile

用于将框架拉入app

use_frameworks!

plugin 'cocoapods-art',:sources => [
  'companyname-public'
]

target 'ProjectNameTest' do
  pod 'ProjectName'
end

解决方法

我能够通过改变来解决这个问题:
spec.resource_bundle = { 'ProjectName' => ['ProjectName/Resources/**/*'] }

spec.resources = 'ProjectName/Resources/**/*'
原文链接:https://www.f2er.com/iOS/328780.html

猜你在找的iOS相关文章