diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b73c848..5ce5325b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ # Unreleased - Fix a crash when a server error response carries a non-string value under its `error` key. The EMM error handler sent `-hasPrefix:` to whatever value was present, raising an unrecognized selector exception on a number, array or object. - Fix a custom `nonce` and requested token `claims` being dropped when a sign-in is continued after a Device Policy app restart. -- Add Swift Package Manager support for AppCheckCore 12.x, enabling compatibility with Firebase 13. CocoaPods installations remain restricted to AppCheckCore 11.x. ([#626](https://github.com/google/GoogleSignIn-iOS/pull/626)) +- Deprecate CocoaPods distribution. This is the last release published to CocoaPods; CocoaPods trunk becomes read-only on December 2, 2026. Migrate to Swift Package Manager using [MIGRATING_FROM_COCOAPODS.md](MIGRATING_FROM_COCOAPODS.md). ([#607](https://github.com/google/GoogleSignIn-iOS/issues/607)) +- Add Swift Package Manager support for AppCheckCore 12.x, enabling compatibility with Firebase 13. The CocoaPods podspec also accepts AppCheckCore 11.x or 12.x. ([#626](https://github.com/google/GoogleSignIn-iOS/pull/626)) - Fix a failed App Check preparation being recorded as successful, which made later calls to `-[GIDSignIn configureWithCompletion:]` report success without retrying. ([#626](https://github.com/google/GoogleSignIn-iOS/pull/626)) - With AppCheckCore 11.x (including all CocoaPods installations), a custom App Check provider that returns neither a token nor an error is now treated as success instead of failing with `kGIDAppCheckUnexpectedError`. ([#626](https://github.com/google/GoogleSignIn-iOS/pull/626)) - Fix a data race on `GIDGoogleUser`'s tokens. Concurrent token updates could write the access, refresh and ID tokens from different threads at once, and readers could observe a partially updated set. The tokens, granted scopes, configuration and profile are now published together as one snapshot. diff --git a/GoogleSignIn.podspec b/GoogleSignIn.podspec index 742534cd..52c6c0e7 100644 --- a/GoogleSignIn.podspec +++ b/GoogleSignIn.podspec @@ -33,7 +33,7 @@ The Google Sign-In SDK allows users to sign in with their Google account from th ] s.ios.framework = 'UIKit' s.osx.framework = 'AppKit' - s.dependency 'AppCheckCore', '~> 11.0' + s.dependency 'AppCheckCore', '>= 11.0', '< 13.0' s.dependency 'AppAuth', '~> 3.0' s.dependency 'GTMAppAuth', '~> 6.0' s.dependency 'GTMSessionFetcher/Core', '>= 3.3', '< 6.0' diff --git a/MIGRATING_FROM_COCOAPODS.md b/MIGRATING_FROM_COCOAPODS.md new file mode 100644 index 00000000..435de5c2 --- /dev/null +++ b/MIGRATING_FROM_COCOAPODS.md @@ -0,0 +1,57 @@ +# Migrating from CocoaPods to Swift Package Manager + +CocoaPods trunk becomes read-only on December 2, 2026. Google Sign-In 10.1.0 is the last version published to CocoaPods (both the `GoogleSignIn` and `GoogleSignInSwiftSupport` pods). Existing pod versions remain installable, but future Google Sign-In releases are distributed via Swift Package Manager only. + +## Steps + +1. In the project directory, remove the `pod 'GoogleSignIn'` and `pod 'GoogleSignInSwiftSupport'` lines from the `Podfile`. If these were the only pods, run `pod deintegrate`, delete the `Podfile`, `Podfile.lock`, and the generated `.xcworkspace`, and open the `.xcodeproj` from then on. +2. In Xcode: **File > Add Package Dependencies…**, enter `https://github.com/google/GoogleSignIn-iOS`, and choose "Up to Next Major Version" from the current version. +3. Add the product(s) matching your old pod(s) to each target (table below). +4. Imports do not change. Clean the build folder and build. + +| Podfile entry | SPM product | Swift import | Objective-C import | +| --- | --- | --- | --- | +| `pod 'GoogleSignIn'` | `GoogleSignIn` | `import GoogleSignIn` | `@import GoogleSignIn;` | +| `pod 'GoogleSignInSwiftSupport'` | `GoogleSignInSwift` | `import GoogleSignInSwift` | (Swift only) | + +Note: The `GoogleSignInSwiftSupport` pod already built a module named `GoogleSignInSwift`, so existing imports keep working unchanged. + +## Resources + +Under Swift Package Manager, the SDK's resources ship in a bundle named `GoogleSignIn_GoogleSignIn.bundle` instead of `GoogleSignIn.bundle`. The SDK locates its own bundle automatically; only apps that looked up the bundle by name themselves need to update that lookup. + +## Don't mix package managers + +Google Sign-In depends on `AppAuth`, `GTMAppAuth`, `GTMSessionFetcher`, and `AppCheckCore`. If Firebase or another pod in your `Podfile` shares any of those dependencies, migrate them to Swift Package Manager at the same time. Mixing CocoaPods and Swift Package Manager copies of the same library in one target leads to dependency cycles and build errors. See [Firebase's CocoaPods deprecation guide](https://firebase.google.com/docs/ios/cocoapods-deprecation). + +## If you can't migrate yet + +You can stay on Google Sign-In 10.1.0 via CocoaPods. + +### Building with Xcode 27 + +Xcode 27 refuses to build any target whose iOS deployment target is below 15.0. Several of Google Sign-In's transitive pods (`AppCheckCore`, `GoogleUtilities`, `RecaptchaInterop`, `PromisesObjC`, and `PromisesSwift`) still declare lower floors in their podspecs, so a project that installs Google Sign-In through CocoaPods and builds under Xcode 26 fails under Xcode 27 with deployment-target errors in the generated Pods project. Those floors belong to the upstream pods, and Google Sign-In cannot raise them from its own podspec. + +Until you migrate, add a `post_install` hook to your `Podfile` that raises the generated Pods targets to your app's own minimum. The sample apps in this repository use the same hook. + +```ruby +post_install do |installer| + # Xcode 27 refuses to build a target whose deployment target is below iOS 15.0. + # Several transitive pods still declare lower floors in their own podspecs, so + # raise the generated Pods project targets to match the app's own minimum. + installer.pods_project.targets.each do |target| + target.build_configurations.each do |config| + ios = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] + if ios && Gem::Version.new(ios) < Gem::Version.new('15.0') + config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.0' + end + end + end +end +``` + +Run `pod install` again after adding the hook. + +## Cross-platform wrappers + +Flutter's `google_sign_in_ios` plugin already ships a `Package.swift` alongside its podspec. For other wrappers (React Native, Unity, etc.), check the plugin's own documentation for its Swift Package Manager support rather than editing its `Podfile` entries directly. diff --git a/README.md b/README.md index ade720e0..7f6d075b 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,12 @@ -[![Version](https://img.shields.io/cocoapods/v/GoogleSignIn.svg?style=flat)](https://cocoapods.org/pods/GoogleSignIn) -[![Platform](https://img.shields.io/cocoapods/p/GoogleSignIn.svg?style=flat)](https://cocoapods.org/pods/GoogleSignIn) -[![License](https://img.shields.io/cocoapods/l/GoogleSignIn.svg?style=flat)](https://cocoapods.org/pods/GoogleSignIn) +[![Release](https://img.shields.io/github/v/release/google/GoogleSignIn-iOS?style=flat)](https://github.com/google/GoogleSignIn-iOS/releases) +[![Swift Package Manager](https://img.shields.io/badge/Swift_Package_Manager-compatible-brightgreen?style=flat)](https://swift.org/package-manager/) +[![License](https://img.shields.io/github/license/google/GoogleSignIn-iOS?style=flat)](LICENSE) [![unit_tests](https://github.com/google/GoogleSignIn-iOS/actions/workflows/unit_tests.yml/badge.svg?branch=main)](https://github.com/google/GoogleSignIn-iOS/actions/workflows/unit_tests.yml) [![integration_tests](https://github.com/google/GoogleSignIn-iOS/actions/workflows/integration_tests.yml/badge.svg?branch=main)](https://github.com/google/GoogleSignIn-iOS/actions/workflows/integration_tests.yml) +> [!IMPORTANT] +> **CocoaPods distribution is deprecated.** CocoaPods trunk becomes read-only on December 2, 2026, and future Google Sign-In releases will be distributed through Swift Package Manager only. See [Migrating from CocoaPods to Swift Package Manager](MIGRATING_FROM_COCOAPODS.md). + # Google Sign-In for iOS and macOS Get users into your apps quickly and securely, using a registration system they @@ -13,21 +16,34 @@ Visit [our developer site](https://developers.google.com/identity/sign-in/ios/) for integration instructions, documentation, support information, and terms of service. -## Getting Started +## Installation -Try either the [Objective-C](Samples/ObjC) or [Swift](Samples/Swift) sample app. -For example, to demo the Objective-C sample project, you have two options: +Google Sign-In is distributed with [Swift Package Manager](https://swift.org/package-manager/). -1. Using CocoaPod's `install` method: +In Xcode, choose **File > Add Package Dependencies…**, enter +`https://github.com/google/GoogleSignIn-iOS`, and add the product you need to your target: +* `GoogleSignIn` — the core SDK (Swift and Objective-C). +* `GoogleSignInSwift` — the SwiftUI `GoogleSignInButton`. + +Or add it to your `Package.swift`: + +```swift +dependencies: [ + .package(url: "https://github.com/google/GoogleSignIn-iOS", from: "10.0.0") +] ``` -git clone https://github.com/google/GoogleSignIn-iOS -cd GoogleSignIn-iOS/Samples/ObjC/SignInSample/ -pod install -open SignInSampleForPod.xcworkspace -``` -2. Using [Swift Package Manager](https://swift.org/package-manager/): +and depend on `.product(name: "GoogleSignIn", package: "GoogleSignIn-iOS")` (and, for SwiftUI, +`.product(name: "GoogleSignInSwift", package: "GoogleSignIn-iOS")`) in your target. + +If you currently use CocoaPods, see +[Migrating from CocoaPods to Swift Package Manager](MIGRATING_FROM_COCOAPODS.md). + +## Getting Started + +Try either the [Objective-C](Samples/ObjC) or [Swift](Samples/Swift) sample app. +For example, to demo the Objective-C sample project: ``` git clone https://github.com/google/GoogleSignIn-iOS