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

Support for Xcode 13 beta 3 #649

Closed
wants to merge 2 commits into from

Conversation

cabeca
Copy link

@cabeca cabeca commented Jul 15, 2021

This PR depends on and includes #604

davbeck and others added 2 commits November 30, 2020 13:19
This removes the warning about iOS 8 no longer being supported in Xcode 12 while maintaining support for older versions of Xcode. Technically checking the compiler version isn’t an exact 1:1 for checking for Xcode version, but in practice should work in all scenarios.
Comment on lines +166 to +171
// Xcode 13 beta 3 introduces a breaking change for APIs marked unavailable for iOS extensions
// https://developer.apple.com/documentation/xcode-release-notes/xcode-13-beta-release-notes
// The solution is to annotate apis that depend on APIs marked unavailable (sharedApplication, openURL).
// An easier solution is to remove those APIs in the first place.
// less than iOS 15, on Xcode 13
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 150000
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, this issue is depends on not iOS 15 but Xcode 13, so this fix is no effect for earlier versions.
By using NS_EXTENSION_UNAVAILABLE_IOS macro for whole function, this issue will be fixed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that route first. As soon as you mark this function NS_EXTENSION_UNAVAILABLE_IOS , you have to mark all functions depending on this one with NS_EXTENSION_UNAVAILABLE_IOS in turn. You will need to do this in 4 places in this library, and the user of this library will have to also mark any of their methods that use one of these newly annotated methods with NS_EXTENSION_UNAVAILABLE_IOS

Instead of creating this cascading effect that will eventually end up in the users of this library, I have built upon the fact that if you're using Xcode 12 or above, you will need to use #604 that drops support for iOS 8. If you are using Xcode 13, you're definitely going to have to use #604 , so this code becomes irrelevant:

    // iOS 8 and earlier, use mobile Safari
     if (!openedUserAgent){
       openedUserAgent = [[UIApplication sharedApplication] openURL:requestURL];
     }

This code contains the only two apis that cause the need for NS_EXTENSION_UNAVAILABLE_IOS: sharedApplication and openURL . If we conditionally remove them for Xcode 13, the problem goes away.

@cabeca cabeca closed this Oct 12, 2023
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

Successfully merging this pull request may close these issues.

3 participants