Skip to content

Suggestion to use different targets using the same Pods #73

@francisrod01

Description

@francisrod01

I suggest you to add how to build different schemes using the same Pods, protecting to import many times the same Framework and both targets.


I'm new in Swift 3 and I started on project that use two targets, one for Dev, but not specified into PodFile. This Dev target should be run a SH file using rsync to protect against multiple targets copying the same framework dependencies at the time.

Stack

   CocoaPods : 1.5.3
        Ruby : ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin17]
    RubyGems : 2.5.2.3
        Host : Mac OS X 10.13.6 (17G65)
       Xcode : 8.3 (8E162)
         Git : git version 2.18.0
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ c90001fac54381e04d0cdcb8a50fe65792ccbbf8

Installation Source

Executable Path: /usr/local/bin/pod

Plugins

cocoapods-clean       : 0.0.1
cocoapods-deintegrate : 1.0.2
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.3.0
cocoapods-try         : 1.1.0

Podfile

# Uncomment this line to define a global platform for your project
platform :ios, '9.3'
# Uncomment this line if you're using Swift
use_frameworks!

target 'my-Project' do

	pod 'Alamofire', '~> 4.0'
	pod 'MBProgressHUD'
	pod 'PromiseKit', '~> 4.0'
	pod 'MBAutoGrowingTextView', '~> 0.1.0'
	pod 'PusherSwift', '~> 3.0'
	pod 'PopupDialog', '~> 0.4'
	pod 'SwiftMessages', '3.5.1'
	pod 'Bugsnag'
	pod 'AutoCompleteTextField'

	pod 'Fabric'
	pod 'Crashlytics'

	target 'my-ProjectTests' do
		inherit! :search_paths
	end
end

post_install do |installer|
	installer.pods_project.targets.each do |target|
		target.build_configurations.each do |config|
			config.build_settings['SWIFT_VERSION'] = '3.0'
		end
	end
end

The problem is this DEV target don't have any import to Pods framework, so the Framework Search Paths pointing to another path.

See the screenshot below:

image

And then there's no posible to import the Framework.

References:

https://forums.swift.org/t/how-to-use-the-same-pods-to-two-targets/14858

https://stackoverflow.com/questions/51615588/run-script-from-build-phrase-not-run-in-xcode-8-3

https://medium.com/@trionkidnapper/disabling-crashlytics-crash-reporting-fabric-on-debug-builds-aee6fdc34a57

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions