fix(ios): Remove undeclared UIViewLayoutRegion for iOS 18/Xcode 16 compatibility#645
Open
jvallori wants to merge 2 commits intoTimOliver:mainfrom
Open
fix(ios): Remove undeclared UIViewLayoutRegion for iOS 18/Xcode 16 compatibility#645jvallori wants to merge 2 commits intoTimOliver:mainfrom
jvallori wants to merge 2 commits intoTimOliver:mainfrom
Conversation
alexcatano562-netizador
approved these changes
Apr 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
UIViewLayoutRegionAPI was included in earlier versions of the iOS 17 beta but has since been completely removed from the iOS 18 / Xcode 16 SDK.Currently, on the
mainbranch, the code attempts to disable this block by wrapping it inif (@available(iOS 26.0, *)). However, in C and Objective-C, the compiler tokenizes and type-checks the entire file regardless of runtime conditionals. SinceUIViewLayoutRegionis not declared anywhere in the iOS 18 headers, compiling this file on Xcode 16 throws a semantic compiler error:Use of undeclared identifier 'layoutRegion', which completely breaks any project depending on this CocoaPod (including those usingflutter_image_cropper).Solution
This PR resolves the compiler error by wrapping the disabled block in a proper preprocessor directive (
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 180000). This ensures that the Xcode 16 compiler completely ignores the undeclared identifier during the build step, while preserving the behavior for older SDKs.This is a critical fix required for any project migrating to macOS-15 and Xcode 16.