Google map not showing up on iPhone

50 views
Skip to first unread message

cha...@moondustapp.com

unread,
Jul 27, 2016, 10:48:24 PM7/27/16
to CodenameOne Discussions
 iPhone 5S, iOS 8.3 (12F70). Codename One lib v 121.


The Google map works quite well on the simulator, but nothing renders on iPhone. Below are the properties that might be relevant. (Some of these I added from the documentation, others seem to have been recently introduced by the new library update.) 

 

codename1.arg.ios.objC=true

codename1.arg.ios.glAppDelegateHeader=\n\#import "GoogleMaps/GoogleMaps.h"

codename1.arg.ios.pods.platform=7.0

codename1.arg.android.includeGPlayServices=true
codename1.arg.ios.afterFinishLaunching=[GMSServices provideAPIKey\:@"..."];

codename1.arg.ios.pods=,GoogleMaps

codename1.arg.ios.pods.sources=,https\://github.com/CocoaPods/Specs.git



Here is my simple code.


        final MapContainer mapContainer = new MapContainer();
form.add(mapContainer);
Coord position = new Coord(40.748817, -73.985428);
mapContainer.setCameraPosition(position);


I will note that in the simulator, I am getting this error message

WARNING: Apple will no longer accept http URL connections from applications you tried to connect to http://tile.openstreetmap.org/4/3/3.png to learn more check out https://www.codenameone.com/blog/ios-http-urls.html


Thank you!



Shai Almog

unread,
Jul 28, 2016, 12:52:15 AM7/28/16
to CodenameOne Discussions, cha...@moondustapp.com
The simulator doesn't show the actual native maps so it will "just work".
Did you set the API key properly?

cha...@moondustapp.com

unread,
Jul 28, 2016, 2:25:54 AM7/28/16
to CodenameOne Discussions, cha...@moondustapp.com
Yes, I just double checked it against the Google API console.

I added this line of libs

codename1.arg.ios.add_libs=libc++.dylib;libicucore.dylib;libz.dylib;CoreData.framework;CoreText.framework;GLKit.framework;ImageIO.framework;SystemConfiguration.framework

and nothing changed.

Shai Almog

unread,
Jul 29, 2016, 1:08:19 AM7/29/16
to CodenameOne Discussions, cha...@moondustapp.com
That's not the key see this:
http://stackoverflow.com/questions/38215666/android-phone-will-not-show-map-only-blank-map

See my last paragraph, connect the device with DDMS and see if it prints out an error this usually includes corrected SHA values...

Charles Hope

unread,
Jul 29, 2016, 11:15:10 AM7/29/16
to Shai Almog, CodenameOne Discussions
Right, my iOS API key is in the properties file like

codename1.arg.ios.afterFinishLaunching=[GMSServices provideAPIKey\:@"AIza...D6yw"];
along with (relevant for iOS)

codename1.arg.ios.objC=true
codename1.arg.ios.pods.platform=7.0
codename1.arg.ios.add_libs=libc++.dylib;libicucore.dylib;libz.dylib;CoreData.framework;CoreText.framework;GLKit.framework;ImageIO.framework;SystemConfiguration.framework
codename1.arg.ios.glAppDelegateHeader=\n\#import "GoogleMaps/GoogleMaps.h"
codename1.arg.ios.pods=,GoogleMaps
codename1.arg.ios.pods.sources=,https\://github.com/CocoaPods/Specs.git
codename1.arg.ios.includePush=true


I'm having the trouble on iPhone, so no DDMS. Evidently something else is wrong in the properties file? These new lines that mention "ios.pods" weren't added by me, but presumably by the ant building process.

I generated an Android API key too, and the map loads on the Android version, except the MapContainer is only one tile high! And I tried making it bigger with a setHeight(), which didn't work. How can I force it larger?

Thank you!




Shai Almog

unread,
Jul 30, 2016, 1:03:55 AM7/30/16
to CodenameOne Discussions, shai....@gmail.com, cha...@moondustapp.com
So this is probably an issue with the layout. Make sure your form has a border layout and that the map is placed in the center of that.
Reply all
Reply to author
Forward
0 new messages