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

Plugin uses APIs made unavailable to extensions in iOS 15/Xcode 13b3 #343

Closed
JetForMe opened this issue Jul 15, 2021 · 5 comments
Closed

Comments

@JetForMe
Copy link

Integration Details (please complete the following information):

  • SDK/Library Version: 9.1.0
  • iOS Version: Deploy 14.4, 15b3 SDK
  • Integration type & version SPM

Describe the bug

Compiling our project, which uses the Braintree drop-in, results in the following errors:

…/SourcePackages/checkouts/braintree-ios-drop-in/Sources/BraintreeDropIn/Helpers/BTUIKViewUtil.m:238:27: 'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.

…/SourcePackages/checkouts/braintree-ios-drop-in/Sources/BraintreeDropIn/Helpers/BTUIKViewUtil.m:250:42: 'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.

…/SourcePackages/checkouts/braintree-ios-drop-in/Sources/BraintreeDropIn/Helpers/BTUIKViewUtil.m:263:64: 'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.

…/SourcePackages/checkouts/braintree-ios-drop-in/Sources/BraintreeDropIn/Helpers/BTUIKViewUtil.m:271:46: 'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.

        return CGRectGetHeight(UIApplication.sharedApplication.statusBarFrame);
                                             ^
In module 'UIKit' imported from …/SourcePackages/checkouts/braintree-ios-drop-in/Sources/BraintreeDropIn/Helpers/BTUIKViewUtil.h:1:
≥/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:114:54: note: property 'sharedApplication' is declared unavailable here
@property(class, nonatomic, readonly) UIApplication *sharedApplication NS_EXTENSION_UNAVAILABLE_IOS("Use view controller based solutions where appropriate instead.");
                                                     ^
…/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:114:54: note: 'sharedApplication' has been explicitly marked unavailable here

To Reproduce
Steps to reproduce the behavior:

  1. Build an iOS app with the drop-in with Xcode 13b3
@JetForMe JetForMe changed the title Xcode 13b3 causes compilation error Plugin uses APIs made unavailable to extension in iOS 15/Xcode 13b3 Jul 16, 2021
@JetForMe JetForMe changed the title Plugin uses APIs made unavailable to extension in iOS 15/Xcode 13b3 Plugin uses APIs made unavailable to extensions in iOS 15/Xcode 13b3 Jul 16, 2021
@scannillo
Copy link
Contributor

👋 Hey @JetForMe - we will take a look at this on the new beta. Thanks for opening this issue!

@JetForMe
Copy link
Author

I'm under a crushing deadline or I would have explored a workaround. I'm still stuck on 13b1, in part because 13b2 changed the way an API works ("cgImageRepresentation() and previewCGImageRepresentation() now return CGImage? instead of Unmanaged? in Swift. (44734827)"), making it incompatible with <=13b1, and in part because I deleted my 13b2, so my only option is 13b3, and I can't move to that because of this issue. I'm not sure what you guys use the shared application for (I mean, I can see the calls you're making, but I don't know their purpose, or if our use of the drop-in even ends up there.

So, I'd really love to be able to move to b3 to see if I can resolve this AVFoundation change in a way that works under both Xcode 12 and 13. Thanks!

@scannillo
Copy link
Contributor

👋 Looks like this issue is related to a bug fix in the latest Xcode beta:
See release notes

Linking Swift packages from application extension targets or watchOS applications no longer emits unresolvable warnings about linking to libraries not safe for use in application extensions. This means that code referencing APIs annotated as unavailable for use in app extensions must now themselves be annotated as unavailable for use in application extensions, in order to allow that code to be used in both apps and app extensions. (66928265)

A similar issue in the Facebook SDK was found.

Will keep you updated as we work on a fix.

@JetForMe
Copy link
Author

Yeah, I had a related issue in one of my own apps with an update in Xcode 11.4. I look forward to your fixes!

@scannillo scannillo mentioned this issue Jul 20, 2021
1 task
@scannillo
Copy link
Contributor

👋 Hi @JetForMe - v9.2.0 has been released with this fix! https://github.com/braintree/braintree-ios-drop-in/releases/tag/9.2.0

Thank you again for reporting this issue to us 😄

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

2 participants