diff --git a/Package.swift b/Package.swift index 563bdfdde..63a801ac4 100644 --- a/Package.swift +++ b/Package.swift @@ -20,14 +20,28 @@ import PackageDescription limitations under the License. */ +var platforms: [SupportedPlatform] { + #if compiler(<5.3) + return [ + .macOS(.v10_10), + .iOS(.v8), + .tvOS(.v9), + .watchOS(.v2), + ] + #else + // Xcode 12 (which ships with Swift 5.3) drops support for iOS 8 + return [ + .macOS(.v10_10), + .iOS(.v9), + .tvOS(.v9), + .watchOS(.v2), + ] + #endif +} + let package = Package( name: "AppAuth", - platforms: [ - .macOS(.v10_10), - .iOS(.v8), - .tvOS(.v9), - .watchOS(.v2) - ], + platforms: platforms, products: [ .library( name: "AppAuthCore", diff --git a/Source/AppAuth/iOS/OIDExternalUserAgentIOS.m b/Source/AppAuth/iOS/OIDExternalUserAgentIOS.m index 728f0868d..be20b9af1 100644 --- a/Source/AppAuth/iOS/OIDExternalUserAgentIOS.m +++ b/Source/AppAuth/iOS/OIDExternalUserAgentIOS.m @@ -163,10 +163,17 @@ - (BOOL)presentExternalUserAgentRequest:(id)request openedUserAgent = YES; } } - // iOS 8 and earlier, use mobile Safari - if (!openedUserAgent){ - openedUserAgent = [[UIApplication sharedApplication] openURL:requestURL]; - } +// 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 + // iOS 8 and earlier, use mobile Safari + if (!openedUserAgent){ + openedUserAgent = [[UIApplication sharedApplication] openURL:requestURL]; + } +#endif if (!openedUserAgent) { [self cleanUp];