iOS Question Google Maps SDK is crashing [Solved]

Carlos marin

Active Member
Licensed User
Longtime User
hello all, in previous days I published this on android (https://www.b4x.com/android/forum/threads/google-maps-sdk-is-crashing-solved.116774/ ) , even though the problem has already been solved even in some cases of IOS they report that this fault continues.

I implemented this code thinking that this would solve the failure but not. Is there already a definitive solution for IOS?

Code:
B4X:
If File.Exist(File.DirInternal, "google_bug") = False Then
File.Delete(File.DirInternal, "ZoomTables.data")
File.WriteString(File.DirInternal, "google_bug", "")
End If

Thanks for the help
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Add this code:
B4X:
#if OBJC
- (void) fixGoogleMapsIssue {
NSString *key = @"GoogleMapsServerControlledParamsKey_bug_154855417";
BOOL keyExists = [[NSUserDefaults standardUserDefaults] boolForKey:key];
if (!keyExists) {
    NSArray<NSURL *> *array =
        [[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory
                                               inDomains:NSUserDomainMask];
    if (array.count > 0) {
        NSURL *url =
            [array[0] URLByAppendingPathComponent:@"com.google.GoogleMaps/ServerControlledParams"
                                      isDirectory:NO];
        if (url) {
            [[NSFileManager defaultManager] removeItemAtURL:url error:NULL];
        }
    }
    [[NSUserDefaults standardUserDefaults] setBool:YES forKey:key];
}
}
#End If

Call it when the app starts, before loading the layout:
B4X:
Dim no As NativeObject = Me
no.RunMethod("fixGoogleMapsIssue", Null)
 
Upvote 0

Carlos marin

Active Member
Licensed User
Longtime User
hi experts, 😓
I uploaded the code described by erel but apparently some are still showing up with the bug
the users have in common the 'xr' model version (view attachments)

mi addmap just in case

B4X:
Private Sub AddMap
    gmap.Initialize("gmap", miclase.api_key)
    Pnlmapa.AddView(gmap, 0, 0, 100%X, 100%y)
    'gmap.MapType = gmap.MAP_TYPE_TERRAIN
    gmap.GetUiSettings.CompassEnabled = True
    gmap.GetUiSettings.MyLocationButtonEnabled = True
    gmap.MyLocationEnabled = True
    Sleep(400)
    Try
        Latitud2 = gmap.MyLocation.Latitude
        longitud2 = gmap.MyLocation.Longitude
        amarker = gmap.AddMarker3(6.249185030951583,-75.56865990535721,"",LoadBitmap(File.DirAssets,"iconomaps2.png"))
    Catch
        Latitud2 = 6.249185030951583
        longitud2 = -75.56865990535721
        amarker = gmap.AddMarker3(6.249185030951583,-75.56865990535721,"",LoadBitmap(File.DirAssets,"iconomaps2.png"))
    End Try

    Dim c As CameraPosition
    c.Initialize(Latitud2,longitud2, 17)
    gmap.AnimateCamera(c)
    gmap.SetLayoutAnimated(0, 1, 0, 0, Pg.RootPanel.Width,Pg.RootPanel.Height)
End Sub
 

Attachments

  • WhatsApp Image 2020-05-16 at 12.51.18 PM.jpeg
    WhatsApp Image 2020-05-16 at 12.51.18 PM.jpeg
    42.8 KB · Views: 140
  • WhatsApp Image 2020-05-16 at 1.08.09 PM.jpeg
    WhatsApp Image 2020-05-16 at 1.08.09 PM.jpeg
    81.8 KB · Views: 133
Upvote 0

Carlos marin

Active Member
Licensed User
Longtime User
:confused:the problem continues what do I do?






I have called the code from the beginning as you indicate erel but it seems that on some iphone it does not work on the XR for example.
no one else has this problem?

B4X:
Private Sub Application_Start (Nav As NavigationController)
 
    Dim no As NativeObject = Me
    no.RunMethod("fixGoogleMapsIssue", Null)
 
 
    '*J*---------------------------------------------------------------------
    '------------------------------------------------------------------------
    fcumple = ""
    miclase.pw1="S"
    '-------------- Boton Aceptar en campos de texto---------------------
    Dim b As Button
    b.InitializeCustom("b",Colors.White,Colors.White)
'    b.Initialize("b",b.STYLE_SYSTEM)
'    b.CustomLabel.TextColor = Colors.White
    '---------------------------------------------------------------------
    login_user
    paddingtext
 
End Sub
I'm going to try to get an iphone xr to test and publish them in due course
 
Last edited:
Upvote 0

Carlos marin

Active Member
Licensed User
Longtime User
I have already been able to test on an x version, an error in not initializing the marker because it seems that the gmap_CameraChange event fires first. thank you all very much and Erel for the help provided 🙏 🙏 ;)
 
Upvote 0

Similar Threads

D
  • Question
iOS Question Maps SDK for iOS v2.6
Replies
5
Views
947
Deleted member 103
D
  • Locked
  • Article
iOS Tutorial GoogleMaps Tutorial
Replies
93
Views
46K
Top