こちらのガイドに従って、iOSにGoogleマップビューをロードしようとしています
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 が位置情報へのアクセス許可を求めた後、アラートが表示され、[OK] をタップすると、何も表示されず、コンソールに次のエラーが表示されます」
Failed to make complete framebuffer object 8cd6
ありがとう