我正在尝试按照此处的指南在 iOS 中加载谷歌地图视图
我为地图视图创建了一个名为 iptechMapViewController.h 、 iptechMapViewController.m 和 iptechMapViewController.xib 的新 viewController
这是 iptechMapViewController.m 中的代码:
#import "iptechMapViewController.h"
#import <GoogleMaps/GoogleMaps.h>
@interface iptechMapViewController ()
{
GMSMapView *mapView_;
}
@end
@implementation iptechMapViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)loadView
{
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.8683
longitude:151.2086
zoom:6];
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = YES;
self.view = mapView_;
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(-33.8683, 151.2086);
marker.title = @"Sydney";
marker.snippet = @"Australia";
marker.map = mapView_;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
然后在另一个名为 iptechFlipsideViewController.m 的视图控制器中,我试图显示 iptechMapViewController 如下:
- (IBAction)showMap:(id)sender
{
iptechMapViewController *controller = [[iptechMapViewController alloc] initWithNibName:@"iptechMapViewController" bundle:nil];
[self.view addSubview:controller.view];
}
但是在单击连接到 IBAction showMap 的 showMap 按钮后,在 iOS 请求访问我的位置警报的权限后,我点击确定,之后什么都没有显示,并且在控制台中我收到以下错误“
Failed to make complete framebuffer object 8cd6
谢谢