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

APPLICATION_EXTENSION_API_ONLY is not set with Xcode 12 & CocoaPods 1.9.3 #10087

Closed
1 task done
pronebird opened this issue Sep 24, 2020 · 20 comments
Closed
1 task done

Comments

@pronebird
Copy link

pronebird commented Sep 24, 2020

Report

What did you do?

I have the following post install hook to make PureLayout work with extensions on iOS:

post_install do |installer|
  # NOTE: If you are using a CocoaPods version prior to 0.38, replace `pods_project` with `project` on the below line
  installer.pods_project.targets.each do |target|
    if target.name.end_with? "PureLayout"
      target.build_configurations.each do |build_configuration|
        if build_configuration.build_settings['APPLICATION_EXTENSION_API_ONLY'] == 'YES'
          build_configuration.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = ['$(inherited)', 'PURELAYOUT_APP_EXTENSIONS=1']
        end
      end
    end
  end
end

But after updating to CocoaPods 1.9.3 & Xcode 12, the APPLICATION_EXTENSION_API_ONLY flag is never set leaving the build configuration broken for PureLayout when built against extensions.

What did you expect to happen?

ℹ Please replace these two lines with what you expected to happen.
e.g. Install all pod dependencies correctly.

What happened instead?

ℹ Please replace these two lines with of what happened instead.
e.g. Pod A is missing the subspec B for target C.

CocoaPods Environment

ℹ Please replace these two lines with the output of pod env.
e.g. via pod env | pbcopy

Project that demonstrates the issue

ℹ Please link to a project we can download that reproduces the issue.
You can delete this section if your issue is unrelated to build problems,
i.e. it's only an issue with CocoaPods the tool.

@dnkoutso
Copy link
Contributor

Please upload a sample app demonstrating the issue.

@dnkoutso
Copy link
Contributor

Its very hard for us to diagnose with the given error report.

@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 Sep 24, 2020
@pronebird
Copy link
Author

pronebird commented Sep 24, 2020

@dnkoutso it's not difficult to reproduce. Before CocoaPods 1.8 APPLICATION_EXTENSION_API_ONLY was set for widget extensions, it's not anymore. I had to downgrade to 1.7.5 to be able to build my project. I believe it's not difficult to set up a sample Xcode project with widget extension target and then just dump build_configuration.build_settings in post_install hook. The issue was raised on PureLayout repo too PureLayout/PureLayout#245

@stale stale bot removed the s1:awaiting input Waiting for input from the original author label Sep 24, 2020
@dnkoutso
Copy link
Contributor

@pronebird hmm We did have this #9233 that says 1.9.0 release and then this #9693 which is for 1.10.0.

Have you tried 1.10.0.rc.1 by any chance?

@pronebird
Copy link
Author

@dnkoutso yeah I saw that issue before & thought that it was fixed, but alas I couldn't build my Xcode project after updating from 1.5 -> 1.9.3. Then I downgraded to 1.8 - same issue, then 1.7.5 which worked. I haven't tried the 1.10 yet, but I can try it tomorrow morning.

@dnkoutso
Copy link
Contributor

Thanks a lot for trying it out. I will try to find sometime myself to check out for prior versions.

@dnkoutso
Copy link
Contributor

Please update here when you try 1.10 version.

@dnkoutso dnkoutso added the s1:awaiting input Waiting for input from the original author label Sep 26, 2020
@pronebird
Copy link
Author

pronebird commented Sep 26, 2020

@dnkoutso so I have just installed the 1.10.0.rc.1:

$ bundle info cocoapods
  * cocoapods (1.10.0.rc.1)
	Summary: The Cocoa library package manager.
	Homepage: https://github.com/CocoaPods/CocoaPods
	Path: /Users/pronebird/.rvm/gems/ruby-2.6.5/gems/cocoapods-1.10.0.rc.1

$ pod --version
1.10.0.rc.1

$ pod install
Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
Pod installation complete! There are 8 dependencies from the Podfile and 8 total pods installed.

Widget target has APPLICATION_EXTENSION_API_ONLY = YES as expected:

Screen Shot 2020-09-26 at 20 25 53

Pods project for the Today widget has APPLICATION_EXTENSION_API_ONLY = NO 😞

Screen Shot 2020-09-26 at 20 29 03

Switched back to 1.7.5:
Screen Shot 2020-09-26 at 20 33 09

@stale stale bot removed the s1:awaiting input Waiting for input from the original author label Sep 26, 2020
@dnkoutso
Copy link
Contributor

It will really help to get a small sample project here that reproduces.

@pronebird
Copy link
Author

@dnkoutso Alright, here you go. I have copied a sample old-fashion widget project by Apple & added CocoaPods 1.10.0.rc.1 and PureLayout pod with no other changes to the source code of the sample app.

Git repo: https://github.com/pronebird/cocoapods-issue-10087

That's what I see on my end:

Screen Shot 2020-09-27 at 13 36 59

@dnkoutso
Copy link
Contributor

Thank you so much! I will hopefully find time this week to take a look.

@dnkoutso dnkoutso removed the s6:need sample Needs a sample project that reproduces the issue label Sep 28, 2020
@igor-makarov
Copy link
Contributor

I see what the problem is - the APPLICATION_EXTENSION_API_ONLY flag moved to the .xcconfig file, and is not in the .pbxproj as perviously.

@dnkoutso it seems like this issue is due to relying on an implementation detail of CocoaPods.

@pronebird - I've checked the uses of the PURELAYOUT_APP_EXTENSIONS flag in the referenced library and there's only one - for RTL checks. It looks like something that might be done much more portably by using an availability check:

if (@available(iOSApplicationExtension 10.0, *)) {
} else {
}

@pronebird
Copy link
Author

@igor-makarov not sure at what point the APPLICATION_EXTENSION_API_ONLY is added to the .xcconfig. I can't see it. https://github.com/pronebird/cocoapods-issue-10087/search?q=APPLICATION_EXTENSION_API_ONLY&type=

@igor-makarov
Copy link
Contributor

@dnkoutso
Copy link
Contributor

So sorry, is this still an issue?

I do not quite understand this:

@dnkoutso it seems like this issue is due to relying on an implementation detail of CocoaPods.

@igor-makarov
Copy link
Contributor

The PureLayout developers are recommending a post_install hook that's no longer working because some implementation detail in project configuration has moved from .pbxproj to .xcconfig.

I have advised them how to resolve this in a more portable way on their end.

I think we can close this, what do you think?

@dnkoutso
Copy link
Contributor

Ah, @pronebird wdyt? I think we can close this yes.

@dnkoutso dnkoutso added the s1:awaiting input Waiting for input from the original author label Sep 28, 2020
@pronebird
Copy link
Author

@dnkoutso I suppose this can be fixed with the proper use of @available as outlined by @igor-makarov.

@stale stale bot removed the s1:awaiting input Waiting for input from the original author label Sep 28, 2020
@dnkoutso
Copy link
Contributor

Sounds good!

@Suri1044
Copy link

Suri1044 commented Dec 2, 2021

i am facing the issue in Xcode 13.1 and CocoaPods 1.11.2. Above links are not working which specified by @igor-makarov igor-makarov. @igor-makarov Need help on this. I have raise issue for this #11082

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants