This is an automated email from the ASF dual-hosted git repository.

GitToTheHub pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/cordova-plugin-inappbrowser.git


The following commit(s) were added to refs/heads/master by this push:
     new bad3830  fix(ios): constraint warnings in iOS 18 and older (#1123)
bad3830 is described below

commit bad38304af3265bd43efb4ece4b2a9876e7cbabf
Author: Manuel Beck <[email protected]>
AuthorDate: Wed Apr 29 19:08:04 2026 +0200

    fix(ios): constraint warnings in iOS 18 and older (#1123)
    
    - On iOS 18 and older contraint warnings are logged when a zero frame is 
set and toolbar items are added. This a known iOS Bug, see: 
https://stackoverflow.com/questions/54284029/uitoolbar-with-uibarbuttonitem-layoutconstraint-issue.
 To avoid this a frame is set, which have no impact, because auto layout is 
used.
---
 src/ios/CDVWKInAppBrowser.m | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/ios/CDVWKInAppBrowser.m b/src/ios/CDVWKInAppBrowser.m
index cce5502..92a35b4 100644
--- a/src/ios/CDVWKInAppBrowser.m
+++ b/src/ios/CDVWKInAppBrowser.m
@@ -756,7 +756,10 @@ BOOL isExiting = NO;
     self.toolbarBackground.backgroundColor = toolbarBackgroundColor;
     [self.view addSubview:self.toolbarBackground];
     
-    self.toolbar = [UIToolbar new];
+    // NOTE: Initializing UIToolbar with initWithFrame: instead of `new` 
prevents
+    // constraint warnings on iOS 18 and older, which has no impact, since auto
+    // layout is used.
+    self.toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0.0, 0.0, 
100.0, 100.0)];
     // Remove the toolbar background on iOS 18 and older
     if (@available(iOS 26.0, *)) {
         // Don't do anything on iOS 26 and newer, there is no background by 
default


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to