Searching for this problem only gave me posts that were regarding opengl stuff that I have no knowledge of whatsoever.
On my Storyboard, I've got 1 view in which I put another slightly smaller UIView object to act as a container for my map. This works fine, not much code at all. I set the class of the UIView to be GMSMapView
. I CTRL-drag it to create a outlet to the corresponding viewController. After this I create a GMSCameraPosition
to a specific location. I set self.mapView
, which is the outlet, to [GMSMapView mapWithFrame:CGRectZero camera:camera];
camera being the camera position I specified.
This seems to work, the app starts without errors and the map is shown in the UIView that I created, but, the camera position is not where I specified. And I know that the position is valid because if I use self.view
instead of self.mapView
the map shows up on the whole screen at the correct position.
In the log I get the error Failed to make complete framebuffer object 8cd6
and as I said, posts regarding this made no sense whatsoever to me, and I am clueless to what problem this is.
I wonder if it might be because you initialize the map view with a frame of CGRectZero
. I think using CGRectZero
is meant to be used when the view is the view controller's root view, meaning it will be resized to the full size of the screen. Maybe you need to set a size, eg:
[GMSMapView mapWithFrame:CGRectMake(0, 0, 300, 300) camera:camera];
For me, this gets the map working/loading the proper coordinates, but still throws the 8cd6 error. Setup: Xcode 4.6.1 iOS 6.1 using storyboard
I have a view inside of a main view/viewcontroller.
Make sure the UIView (the sub view that is to be the map) under the attribute tab -->class = GMSMapView and is linked to the property *mapView below
YourViewController.h:
#import <UIKit/UIKit.h>
#import <GoogleMaps/GoogleMaps.h>
@interface YourViewController : UIViewController
//other @properties
@property (strong, nonatomic) IBOutlet GMSMapView *mapView;//linked to storyboard
@end
YourViewController.m:
#import "YourViewController.h"
#import <GoogleMaps/GoogleMaps.h>
@interface YourViewController()
@end
/*.. ..other setup code ..*/
-(void)viewDidLoad{
[super viewDidLoad];
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.8683 longitude:151.2086 zoom:10];
self.mapView.camera = camera;
}
the 8cd6 error has to do with the frame/bounds (obviously). Something isn't getting called (or set?) if you try to initWithFrame. Loading the view hangs and then defaults to the place near London. I did not edit the setMapView for this solution, I merely skipped setting the bounds and let storyboard take care of that.
Still hope someone finds a fix that clears up the 8cd6 error though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With