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

[Breaking][Xcode 13.0 b3]: "error: 'shared' is unavailable in application extensions for iOS:" #8401

Closed
Panajev opened this issue Jul 17, 2021 · 7 comments · Fixed by #8405
Closed

Comments

@Panajev
Copy link

Panajev commented Jul 17, 2021

[REQUIRED] Step 1: Describe your environment

  • Xcode version: 13.0 b3
  • Firebase SDK version: 8.3.1
  • Installation method: Swift Package Manager
  • Firebase Component: App Distribution

[REQUIRED] Step 2: Describe the problem

Hello,

When compiling our application, I see an error like:

error: 'shared' is unavailable in application extensions for iOS: Use view controller based solutions where appropriate instead.
            if let windowScene = UIApplication.shared.activeScene {

Note that this was not happening in our app with Xcode 13.0 beta 2, it started happening today when I updated to Xcode 13.0 beta 3). Apple requires the library itself to be annotated like so:

@available(iOSApplicationExtension, unavailable)

See: https://forums.swift.org/t/set-application-extension-api-only-on-a-spm-package/39333/11

This is related to a change in Xcode made by Apple deliberately and for which they provided annotation library authors have to add when declaring methods that would trigger that compilation error.

Thank you in advance for your help :)!

Kind Regards,

Goffredo Marocchi

Notes

  • I reported the bug on Apple's Feedback Reporter tool (it affects lots of libraries and I have no way to let SwiftPM know we do not have any App Extension targets...): FB9337463
  • Reported a thread in the dev forums too: https://developer.apple.com/forums/thread/685103

Steps to reproduce:

What happened? How can we make the problem occur?
Download Xcode 13.0 b3, compile a project that imports Firebase iOS SDK (including App Distribution too) using Swift PM (cocoapods works for this library for now).

Relevant Code:

The compilation issue occurs in Firebase's code as the SwiftPM package is imported.

@google-oss-bot
Copy link

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@paulb777
Copy link
Member

@Panajev Thanks for the report. The issue also shows up in Dynamic Links and In App Messaging.

It seems like the right solution for Swift libraries, is to add the @available(iOSApplicationExtension, unavailable) annotation, but it's not immediately clear what to do for Objective C libraries.

@Panajev
Copy link
Author

Panajev commented Jul 17, 2021 via email

@paulb777
Copy link
Member

Suggested approach at https://forums.swift.org/t/set-application-extension-api-only-on-a-spm-package/39333/21. I'll give it a try in the next few days if no one else beats me to it.

@Panajev
Copy link
Author

Panajev commented Jul 19, 2021

Hello @paulb777 thanks for the fix :). Do you think this will be part of an upcoming 8.4.0 release or if I want to build against both Xcode 13 and 12 I should be using a specific commit on SwiftPM?

@paulb777
Copy link
Member

Hi @Panajev We cherry-picked the fix to 8.4.0 so it should be out later this week. In the meantime you could point to the release-8.4 branch.

@Panajev
Copy link
Author

Panajev commented Jul 19, 2021 via email

@firebase firebase locked and limited conversation to collaborators Aug 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants