Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use 'generate_multiple_pod_projects' project error #8967

Closed
LisonFan opened this issue Jul 4, 2019 · 7 comments
Closed

Use 'generate_multiple_pod_projects' project error #8967

LisonFan opened this issue Jul 4, 2019 · 7 comments
Labels
s6:need sample Needs a sample project that reproduces the issue
Milestone

Comments

@LisonFan
Copy link

LisonFan commented Jul 4, 2019

Version
Cocoapods 1.7.3
Ruby 2.6.2

Error Info
image

I am using a search engine to find a solution to this problem
Add configuration in podfile config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO', but did not solve the problem

Podfile

source 'https://github.com/CocoaPods/Specs.git'

install! 'cocoapods',
         :generate_multiple_pod_projects => true,
         :incremental_installation => true

platform :ios, '9.0'

target 'Action Extension' do
  pod 'SVProgressHUD'
end

post_install do |installer|
    installer.pods_project.build_configuration_list.build_configurations.each do |configuration|
        configuration.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
    end
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['ENABLE_BITCODE'] = 'NO'
            config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
        end
    end
end

It seems that this configuration does not take effect in the third-party library.

    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['ENABLE_BITCODE'] = 'NO'
            config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
        end
    end

image

image
image

@dnkoutso
Copy link
Contributor

dnkoutso commented Jul 5, 2019

We cannot debug/diagnose this without a sample app.

@dnkoutso dnkoutso added s6:need sample Needs a sample project that reproduces the issue s1:awaiting input Waiting for input from the original author labels Jul 5, 2019
@LisonFan
Copy link
Author

LisonFan commented Jul 6, 2019

We cannot debug/diagnose this without a sample app.

generate_multiple_pod_projects_demo.zip

@stale stale bot removed the s1:awaiting input Waiting for input from the original author label Jul 6, 2019
@sebastianv1
Copy link
Collaborator

@LisonFan You are using installer.pods_project which only references Pods.xcodeproj. With multi xcode proj there is a separate project per third party pod so you need to apply your hook over that particular project. You're probably looking for installer.generated_projects

...
# @return [Array<Project>] The list of projects generated from the installation.
#
attr_reader :generated_projects
...

You should also run pod install --clean-install whenever you change your post install hook with incremental installation enabled since it's not guaranteed that all projects will be generated.

@LisonFan
Copy link
Author

LisonFan commented Jul 8, 2019

@LisonFan You are using installer.pods_project which only references Pods.xcodeproj. With multi xcode proj there is a separate project per third party pod so you need to apply your hook over that particular project. You're probably looking for installer.generated_projects

...
# @return [Array<Project>] The list of projects generated from the installation.
#
attr_reader :generated_projects
...

You should also run pod install --clean-install whenever you change your post install hook with incremental installation enabled since it's not guaranteed that all projects will be generated.

thank you very much! Your answer helped me solve the problem

post_install do |installer|
  installer.generated_projects.each do |project|
    project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
        config.build_settings['ENABLE_BITCODE'] = 'NO'
        config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
      end
    end
  end
end

@Q14
Copy link

Q14 commented Oct 11, 2019

installer.generated_projects = [] how to reslove it

@iZooto-App-Push
Copy link

'shared' is unavailable in application extensions for iOS: Use view controller based solutions where appropriate instead.

@RandallWang
Copy link

RandallWang commented Jul 7, 2021

installer.generated_projects = [] how to reslove it

If you already generate multiple pod projects, generated_projects will return []
You can try pod install --clean-install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s6:need sample Needs a sample project that reproduces the issue
Projects
None yet
Development

No branches or pull requests

6 participants