iOS Tutorial GoogleMaps Tutorial

Discussion in 'iOS Tutorials' started by Erel, Nov 17, 2014.

Thread Status:
Not open for further replies.
  1. Erel

    Erel Administrator Staff Member Licensed User

    The iGoogleMaps library allows you to show a map inside your app:

    [​IMG]

    It is similar to B4A GoogleMaps library.

    1. In order to use it you need to get a free api key from Google. Follow the "Obtaining an API Key" steps: https://developers.google.com/maps/documentation/ios/start#obtaining_an_api_key

    2. If you are using a local Mac builder then you need to first download the SDK to your Mac computer:
    https://developers.google.com/maps/documentation/ios/start#getting_the_google_maps_sdk_for_ios
    And copy GoogleMaps.framework package to the Libs folder.

    Start with the attached project. You will need to change the package name.

    When you are ready to start a new project you need to:
    3. Add these two attributes to your project (if you want to show the user location):
    Code:
    #PlistExtra:<key>NSLocationWhenInUseUsageDescription</key><string>Used to display the current navigation data.</string>
    #PlistExtra:<key>NSLocationUsageDescription</key><string>Used to display the current navigation data.</string>
    You can change the description text.

    4. Copy the GoogleMaps.bundle folder from the example project (under Files\Special) to Files\Special in your project.

    You can download the example project from: www.basic4ppc.com/b4i/files/GoogleMaps.zip
     
    Last edited: Feb 9, 2015
  2. davepamn

    davepamn Active Member Licensed User

    copy to what libs directory? the application builder libs directory?
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    If you are using a local Mac builder then you need to copy the framework to the Libs folder that is under the builder folder.
     
  4. davepamn

    davepamn Active Member Licensed User

    When you say copy GoogleMaps.Framework under macserver-aa/libs

    will I see macserver-aa/Libs/GoogleMaps.Framework when done?
     
    Last edited: Dec 10, 2014
  5. Erel

    Erel Administrator Staff Member Licensed User

    Yes. Note that the folder name is Libs not libs.
     
  6. davepamn

    davepamn Active Member Licensed User

    I looked at the googlemaps example and saw the plist items were inserted in the project section of the code
     
    Last edited: Dec 10, 2014
  7. davepamn

    davepamn Active Member Licensed User

    I created the "Key for iOS apps (with bundle identifiers)"

    Build Configurations
    Configuration Name=Default
    Package: anywhere software.b4i.googlemaps

    Code:
    PrivateApiKeyAsString = "AIzaSyA-xxxxxxxxxx"
    In the googlemaps demo code

    I get a grey screen with no map. (Resolved)

    It is working
    I changed the version number and iTunes updated the code then the map display.
    Great Job
     
    Last edited: Dec 10, 2014
  8. davepamn

    davepamn Active Member Licensed User

    How do I add a google Map to a tab controller Page?

    I need to load google maps into a panel on my frmPage4 Layout.

    Code:
    gmap.Initialize("gmap", ApiKey)

        
    'Page4.RootPanel.AddView(gmap, 0, 0, 100%X, 100%y)

        panelMap.AddView(gmap, 
    00100%X100%y)

        gmap.MapType = gmap.MAP_TYPE_TERRAIN

        gmap.GetUiSettings.CompassEnabled = 
    True

        gmap.GetUiSettings.MyLocationButtonEnabled = 
    True

        gmap.MyLocationEnabled = 
    True
    The app crashes when using this code.
     
    Last edited: Dec 10, 2014
  9. davepamn

    davepamn Active Member Licensed User

    the error message is "Google Maps SDK for iOS to be part of your target under "Copy Bundle Resources""

    I forgot to "Copy the GoogleMaps.bundle folder from the example project (under Files\Special) to Files\Special in your project."

    I copied the "GoogleMaps.bundle" from sample data. Is that the correct process
     
    Last edited: Dec 10, 2014
  10. davepamn

    davepamn Active Member Licensed User

    it is now working. Amazing
     
  11. ciginfo

    ciginfo Active Member Licensed User

    What is the procedure if no one uses local Mac builder but hosted builder?
    Thank you
     
  12. Erel

    Erel Administrator Staff Member Licensed User

    Follow the steps explained in the first post.
     
  13. schimanski

    schimanski Well-Known Member Licensed User

    In B4A, it is possible to set 'showinfowindow' on true or false. This is usefull to update the infowindow, if the title or the snippet has changed. Is it possoble in B4i to update an markers infowindow, during the infowindow is shown?
     
  14. Erel

    Erel Administrator Staff Member Licensed User

    Have you tried it?
     
  15. schimanski

    schimanski Well-Known Member Licensed User

    Yes, I have tested it. In b4a and b4i, it is not possible to update an open marker-window.
     
  16. Erel

    Erel Administrator Staff Member Licensed User

    This is how GoogleMaps SDK works apparently.
     
  17. schimanski

    schimanski Well-Known Member Licensed User

    Ok. Thanks for your efforts.
     
  18. ciginfo

    ciginfo Active Member Licensed User

    Impossible to test the attached project GoogleMaps. I have changed the package name to "com.ciginfo.maps"
    Below the 2 last lines of the error message

    "Sending data to remote compiler. Error
    Le thread a été abandonné."
     
  19. Erel

    Erel Administrator Staff Member Licensed User

    Can you post a screenshot of this error? How long did it take until you see it?
     
  20. ciginfo

    ciginfo Active Member Licensed User

    It appears 25 or 30 seconds after
     

    Attached Files:

Thread Status:
Not open for further replies.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice