iOS Question Unable to open Maps in iOS 26

ginsh

Member
Licensed User
Longtime User
Hi,

The maps are not opening in iOS 26. It was working fine till previous version. I am using the below code to call the maps. I am getting the option to select Google/Waze, but on clicking the options the map is not opening. Please let me know what the issue could be. Thanks

B4X:
 Select Item
                            Case "Google Maps"
        
                                'If App.CanOpenUrl("Google Maps//") Then
    
                                App.OpenUrl("https://maps.google.com/maps?q=" &DBA.Lat& "," &DBA.Longt)
        
                                
                                'End If
        
    
                            Case "Waze"
                                'If App.CanOpenUrl("Waze//") Then
    
                                App.OpenUrl("waze://?ll="&DBA.Lat&","&DBA.Longt&"navigate=yes")
                
                                'End If
                        End Select
 

JordiCP

Expert
Licensed User
Longtime User
Add this to your code and replace any call to App.OpenURL(...) with App_OpenURL(...)

B4X:
Sub App_OpenURL(theURL As String)
    Me.as(NativeObject).RunMethod("openScheme:", Array(theURL))
End Sub

#If OBJC   
- (void)openScheme:(NSString *)scheme {   
    UIApplication *application = [UIApplication sharedApplication];   
    NSURL *URL = [NSURL URLWithString:scheme];   
    
    if ([application respondsToSelector:@selector(openURL:options:completionHandler:)]) {   
        [application openURL:URL options:@{}   
        completionHandler:^(BOOL success) {   
            NSLog(@"Open %@: %d",scheme,success);   
        }];   
    } else {   
        BOOL success = [application openURL:URL];   
        NSLog(@"Open %@: %d",scheme,success);   
    }   
}   
#End If

It is based on some B4X forum posts (credits to the original authors) that I found when facing the same problem with an old B4I version
 
Upvote 0
Top