Any one using Google Maps SDK Pod ?

843 views
Skip to first unread message

Imran Ansari

unread,
Feb 14, 2013, 3:35:56 AM2/14/13
to rubym...@googlegroups.com
I'm having trouble with this Pod

    pod 'Google-Maps-iOS-SDK', '~> 1.0.2'

When I try using any of its classes, like in my AppDelegate, I have the line below:

    GMSServices.provideAPIKey("YOUR_API_KEY")


I get an error
app_delegate.rb:6:in `application:didFinishLaunchingWithOptions:': uninitialized constant AppDelegate::GMSServices (NameError)


The Pods.bridgesupport seems to have the class and method I'm trying to use.

<class name='GMSServices'>
<method class_method='true' selector='SDKVersion'>
<retval type='@' declared_type='NSString*'/>
</method>
<method class_method='true' selector='openSourceLicenseInfo'>
<retval type='@' declared_type='NSString*'/>
</method>
<method class_method='true' selector='provideAPIKey:'>
<arg index='0' type='@' name='APIKey' declared_type='NSString*'/>
<retval type='B' declared_type='BOOL'/>
</method>
</class>

I'm using a bunch of other PODs successfully, so not sure whats missing, the POD definition seems fine, based on what I see in the BridegSupport file.

Any ideas?

thanks
Imran 


Imran Ansari

unread,
Feb 14, 2013, 3:45:29 AM2/14/13
to rubym...@googlegroups.com
seems like the API keys arent being served yet, and it the tutorial says dont use StoryBoards, oh well..
Message has been deleted

Joffrey Jaffeux

unread,
Feb 14, 2013, 5:17:40 AM2/14/13
to rubym...@googlegroups.com
HI,

can you try to delete your "vendor/Pods" folder, "vendor/Podfile.lock" then execute "rake clean" and then execute "rake"

Imran Ansari

unread,
Feb 14, 2013, 9:36:06 PM2/14/13
to rubym...@googlegroups.com
I did try that to no effect

Christopher Pappas

unread,
May 18, 2013, 8:57:42 PM5/18/13
to rubym...@googlegroups.com
Has anyone been able to integrate the Google Maps SDK into their app?  I tried the example project from Watson, but the bridge-support file is throwing errors.  

"Objective-C stub for message `cameraWithLatitude:longitude:zoom:' type `@@:ddf' not precompiled. Make sure you properly link with the framework or library that defines this message."

Any help would be appreciated!

Christopher Pappas

unread,
May 18, 2013, 9:04:33 PM5/18/13
to rubym...@googlegroups.com
Very strange -- it is now "just working".  Not sure what I did!

Thanks.  

Rocky Signavong

unread,
May 30, 2013, 6:00:24 AM5/30/13
to rubym...@googlegroups.com
Hello,

I got the same error.

Could someone help me to debug this. I tried everything but nothing works....

I try to use new Google-Maps-iOS-SDK with cocoapod too but it doesn't work

Could you help me to debug this please?

Here is my simple code that I take from https://github.com/Watson1978/HelloGoogleMaps :

Rakefile


$

app_delegate.rb (I got error on line 20 GMSServices.provideAPIKey(GOOGLE_MAP_API_KEY) that tells (NameError) could not find reference of GMSServices...)

GOOGLE_MAP_API_KEY = "MY_API_KEY"

class GoogleMapsController < UIViewController
 
def loadView
    camera
= GMSCameraPosition.cameraWithLatitude(35.689466, longitude: 139.700196, zoom: 15)
   
@map_view = GMSMapView.mapWithFrame(CGRectZero, camera: camera)
   
@map_view.myLocationEnabled = true
   
self.view = @map_view

    marker
= GMSMarker.alloc.init
    marker
.position = CLLocationCoordinate2DMake(35.689466, 139.700196)
    marker
.title = "Shinjuku"
    marker
.snippet = "Japan"
    marker
.map = @map_view
 
end
end

class AppDelegate
 
def application(application, didFinishLaunchingWithOptions:launchOptions)
   
GMSServices.provideAPIKey(GOOGLE_MAP_API_KEY)
   
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
   
@window.rootViewController = GoogleMapsController.new
   
@window.makeKeyAndVisible
   
true
 
end
end


I tried to add this like Watson1978 HelloGoogleMaps Sample, but still not works... (I change the 'vendor/GoogleMaps.framework' path with mine 'vendor/Pods/Google-Maps-iOS-SDK/GoogleMaps.framework')

app.vendor_project('vendor/GoogleMaps.framework',
   
:static,
   
:products    => %w{GoogleMaps},
   
:headers_dir => 'Headers')
  app
.resources_dirs << 'vendor/GoogleMaps.framework/Resources'
  app
.frameworks += %w{AVFoundation CoreData CoreLocation CoreText GLKit ImageIO OpenGLES QuartzCore SystemConfiguration}
  app
.libs       += %w{/usr/lib/libicucore.dylib /usr/lib/libc++.dylib /usr/lib/libz.dylib}

What should I do? 

Rocky S.

Rocky Signavong

unread,
May 30, 2013, 6:30:18 AM5/30/13
to rubym...@googlegroups.com
Sorry, here is my Rakefile (it was cropped before...)

# -*- coding: utf-8 -*-
$
:.unshift("/Library/RubyMotion/lib")
require 'motion/project/template/ios'
require 'rubygems'
require 'motion-cocoapods'

Motion::Project::App.setup do |app|
 
# Use `rake config' to see complete project settings.
  app
.name = 'VeliQuest'
  app
.archs['iPhoneOS'] = ['armv7']
  app
.pods do
    pod
'Google-Maps-iOS-SDK'
 
end
end

Christopher Pappas

unread,
May 30, 2013, 12:35:38 PM5/30/13
to rubym...@googlegroups.com
Hey Rocky,

You're missing the system libs and frameworks:

 app.resources_dirs << 'vendor/GoogleMaps.framework/Resources'
  app.frameworks += %w{AVFoundation CoreData CoreLocation CoreText GLKit ImageIO OpenGLES QuartzCore SystemConfiguration}
  app.libs       += %w{/usr/lib/libicucore.dylib /usr/lib/libc++.dylib /usr/lib/libz.dylib}

Those have to be there.

I would recommend just working from Watsons project because you have to hand-edit the .bridgesupport file in the googlemaps.framework folder.  

(If anyone has a work-around so that hand-editing is no longer necessary I would love to hear it -- its hard to keep up with GM updates if you can't rely on the bridgesupport generator.)

Rocky Signavong

unread,
May 30, 2013, 8:19:52 PM5/30/13
to rubym...@googlegroups.com
Ok I see, I tried the Watsons project and it works fine!

I want to use GM API v3 but I wasn't confident the Watsons project was up-to-date so I turned to use GM Pods... but it seems not easy to maintain with that bridgesupport like you said...

All the features I need in my project is to : 
- display google maps, 
- put some pins/marker on it,
- geolocate myself,
- and display direction with polylines,

Do you think the GoogleMaps.framework provided with Watsons project is enough complete to accomplish all this features and not so deprecated?

Thanks for your help! I really appreciate it!

Rocky

Christopher Pappas

unread,
May 30, 2013, 8:21:38 PM5/30/13
to rubym...@googlegroups.com
Hey Rocky,

I actually just ported over a Google Obj-C project to demo just that:


This will do exactly what you need.

Rocky Signavong

unread,
May 30, 2013, 8:37:01 PM5/30/13
to rubym...@googlegroups.com
Wow so cool!

You save me a lot of times!
I'll try your project and come back to you if I find any issue.

Thank you so much Christopher! You are the best!

Rocky S.

wndxlori

unread,
Jun 1, 2013, 2:24:09 AM6/1/13
to rubym...@googlegroups.com
When I try to build and run that project, I get this error:

Objective-C stub for message `cameraWithLatitude:longitude:zoom:' type `@@:ddf' not precompiled.

Any ideas?

Regards, Lori

Rocky Signavong

unread,
Jun 1, 2013, 3:18:49 PM6/1/13
to rubym...@googlegroups.com
Hello,

I've successfully succeed to used the new version of Google Maps iOS SDK with Pods.

Here is what I did. I hope it would be useful to everyone that want to use Google Maps iOS SDK.
As I didn't found a full answer to how to use Google Maps Pods with RubyMotion, I think it would be great share this to all of you.

Once you add Google-Maps-iOS-SDK in your Rakefile, 
you need to launch 'rake' first to downloads GoogleMaps.framework in your Pods directory. At the end it will failed, nevermind...

Then you should specify 'app.vendor_project', 'app.resources_dirs' pointed to your GoogleMaps.frameworks in your Rakefile.
And don't forget to add 'app.frameworks' and 'app.libs'.

Next, if you launch rake again, you would have wndxlori's error message:

Objective-C stub for message `cameraWithLatitude:longitude:zoom:' type `@@:ddf' not precompiled.

Then you need to edit the 'GoogleMaps.framework.bridgesupport' file in your GoogleMaps.frameworks directory included in your Pods directory,
and replace the appropriate lines like this:

<method class_method='true' selector='cameraWithLatitude:longitude:zoom:'>
 
<arg index='0' name='latitude' declared_type='CLLocationDegrees' type='d'/>
 
<arg index='1' name='longitude' declared_type='CLLocationDegrees' type='d'/>
-<arg index='2' name='zoom' declared_type='id' type='@'/>
+<arg index='2' name='zoom' declared_type='CGFloat' type='f'/>
 
<retval declared_type='GMSCameraPosition*' type='@'/>
 
</method>
 <method class_method='true' selector='cameraWithLatitude:longitude:zoom:bearing:viewingAngle:'>
 <arg index='0' name='latitude' declared_type='CLLocationDegrees' type='d'/
>
 
<arg index='1' name='longitude' declared_type='CLLocationDegrees' type='d'/>
-<arg index='2' name='zoom' declared_type='id' type='@'/>
+<arg index='2' name='zoom' declared_type='CGFloat' type='f'/>
 
<arg index='3' name='bearing' declared_type='CLLocationDirection' type='d'/>
 
<arg index='4' name='viewingAngle' declared_type='double' type='d'/>
 
<retval declared_type='GMSCameraPosition*' type='@'/>
 
</method>
 <method class_method='true' selector='cameraWithTarget:zoom:'>
 <arg index='0' name='target' declared_type='CLLocationCoordinate2D' type='{_CLLocationCoordinate2D=dd}'/
>
-<arg index='1' name='zoom' declared_type='id' type='@'/>
+<arg index='1' name='zoom' declared_type='CGFloat' type='f'/>
 
<retval declared_type='GMSCameraPosition*' type='@'/>
 
</method>
 <method class_method='true' selector='cameraWithTarget:zoom:bearing:viewingAngle:'>
 <arg index='0' name='target' declared_type='CLLocationCoordinate2D' type='{_CLLocationCoordinate2D=dd}'/
>
-<arg index='1' name='zoom' declared_type='id' type='@'/>
+<arg index='1' name='zoom' declared_type='CGFloat' type='f'/>
 
<arg index='2' name='bearing' declared_type='CLLocationDirection' type='d'/>
 
<arg index='3' name='viewingAngle' declared_type='double' type='d'/>
 
<retval declared_type='GMSCameraPosition*' type='@'/>
 
</method>
 <method selector='initWithTarget:zoom:bearing:viewingAngle:'>
 <arg index='0' name='target' declared_type='CLLocationCoordinate2D' type='{_CLLocationCoordinate2D=dd}'/
>
-<arg index='1' name='zoom' declared_type='id' type='@'/>
+<arg index='1' name='zoom' declared_type='CGFloat' type='f'/>
 
<arg index='2' name='bearing' declared_type='CLLocationDirection' type='d'/>
 
<arg index='3' name='viewingAngle' declared_type='double' type='d'/>
 <retval declared_type='id' type='@'/> 

Thanks to Christopher to give me this tips.

Next, you need to delete vendor/Podfile.lock and launch 'rake clean'.
And finally 'rake' again and everything will work properly.

Rakefile
# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project/template/ios'
require 'rubygems'
require 'motion-cocoapods'

Motion::Project::App.setup do |app|
  # Use `rake config' to see complete project settings.
  app.name = 'VeliQuest'
  app.archs['iPhoneOS'] = ['armv7']
  app.pods do
    pod 'Google-Maps-iOS-SDK'
  end
  app.vendor_project('vendor/Pods/Google-Maps-iOS-SDK/GoogleMaps.framework',
    :static,
    :products    => %w{GoogleMaps},
    :headers_dir => 'Headers')
  app.resources_dirs << 'vendor/Pods/Google-Maps-iOS-SDK/GoogleMaps.framework/Resources'
  app.frameworks += %w{AVFoundation CoreData CoreLocation CoreText GLKit ImageIO OpenGLES QuartzCore SystemConfiguration}
  app.libs       += %w{/usr/lib/libicucore.dylib /usr/lib/libc++.dylib /usr/lib/libz.dylib}
end

app_delegate.rb (from Watsons project)
GOOGLE_MAP_API_KEY = "YOUR_GOOGLE_API_KEY"

class GoogleMapsController < UIViewController
  def loadView
    camera = GMSCameraPosition.cameraWithLatitude(35.689466, longitude: 139.700196, zoom: 15)
    @map_view = GMSMapView.mapWithFrame(CGRectZero, camera: camera)
    @map_view.myLocationEnabled = true
    self.view = @map_view

    marker = GMSMarker.alloc.init
    marker.position = CLLocationCoordinate2DMake(35.689466, 139.700196)
    marker.title = "Shinjuku"
    marker.snippet = "Japan"
    marker.map = @map_view
  end
end

class AppDelegate
  def application(application, didFinishLaunchingWithOptions:launchOptions)
    GMSServices.provideAPIKey(GOOGLE_MAP_API_KEY)
    @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
    @window.rootViewController = GoogleMapsController.new
    @window.makeKeyAndVisible
    true
  end
end


Happy hacking!

Rocky
Reply all
Reply to author
Forward
0 new messages