Skip to content

fix(ios): Remove undeclared UIViewLayoutRegion for iOS 18/Xcode 16 compatibility#645

Open
jvallori wants to merge 2 commits intoTimOliver:mainfrom
jvallori:fix/remove-uiviewlayoutregion-xcode16
Open

fix(ios): Remove undeclared UIViewLayoutRegion for iOS 18/Xcode 16 compatibility#645
jvallori wants to merge 2 commits intoTimOliver:mainfrom
jvallori:fix/remove-uiviewlayoutregion-xcode16

Conversation

@jvallori
Copy link
Copy Markdown

@jvallori jvallori commented Apr 6, 2026

Description

The UIViewLayoutRegion API 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 main branch, the code attempts to disable this block by wrapping it in if (@available(iOS 26.0, *)). However, in C and Objective-C, the compiler tokenizes and type-checks the entire file regardless of runtime conditionals. Since UIViewLayoutRegion is 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 using flutter_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.

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.

2 participants