Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pod install has required target membership unchecked

Question

How do I configure cocoapods so that running pod install results in the storyboard having ProjectName checked for target membership?

Background

I have a framework and an app that are both created by my company. We use Artifactory and Cocoapods to deploy the framework and pull it into the app. The framework contains a storyboard that is then used by the app to present a form. I am using XCode 8

Pod targets created by 'pod install'

  • ProjectName
  • ProjectName-ProjectName
  • Pods-ProjectNameTest

Problem

The problem is that the targets created by running 'pod install' have to be manually updated.

The storyboard from the framework only has the target membership checked for ProjectName-ProjectName. If I run the app I get the following exception:

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

calling code

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

Workaround

If I manually go to the storyboard and check the target membership for ProjectName this works as expected.

podspec

used to deploy framework

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

used to pull framework into app

use_frameworks!

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

target 'ProjectNameTest' do
  pod 'ProjectName'
end 
like image 986
David Light Avatar asked Oct 06 '16 16:10

David Light


1 Answers

I was able to resolve this by changing:

spec.resource_bundle = { 'ProjectName' => ['ProjectName/Resources/**/*'] } 

to

spec.resources = 'ProjectName/Resources/**/*'
like image 148
David Light Avatar answered Nov 20 '22 11:11

David Light