2014-06-05 3 views
1

Google지도 SDK를 통합하려고 시도 중이고 this link to start from google을 팔로우하고 있습니다. API 키를 만들고 appDelegate에 사용했습니다. 내 ViewController.m 코드 아래에 쓴 및 필요한 모든 프레임 워크를 가져온 또한 -ObjC 다른 링커 플래그를 넣어 있지만 여전히 응용 프로그램이 런타임에 충돌이 있습니다. 중단 점을 사용했지만 로그가 표시되지 않았습니다. 아래는 전체 코드이며 콘센트는 사용하지 않았습니다.앱이 오류없이 충돌합니다.

#import "ViewController.h" 

@interface ViewController() 

@end 

@implementation ViewController 

- (void)viewDidLoad { 
    GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86 
                  longitude:151.20 zoom:6]; 
    mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera]; // crashing here, even gave different frames rather CGRectZero 
    mapView_.myLocationEnabled = YES; 
    self.view = mapView_; 
    // Creates a marker in the center of the map. 
    GMSMarker *marker = [[GMSMarker alloc] init]; 
    marker.position = CLLocationCoordinate2DMake(-33.86, 151.20); 
    marker.title = @"Sydney"; 
    marker.snippet = @"Australia"; 
    marker.map = mapView_; 
} 

@end 

DEMO SAMPLE LINK

답변

1

내가 코드를 다운로드하고 실행합니다. 그것은 완벽하게 잘 작동합니다. 이전 앱을 삭제하고 대상을 지우십시오. 앱을 다시 설치하십시오. 그것은 잘 작동합니다.

+0

xcode 버전 및 iOS 시뮬레이터를 사용하고 계신가요? – iOS

+0

Xcode 5.1.1 및 시뮬레이터 iOS 7.0을 사용하고 있습니다. – Apurv

1

왜지도의 프레임에 CGRectZero를 전달합니까?

다음 코드를 사용해보십시오 : -

- (void)viewDidLoad { 
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86 
                 longitude:151.20 zoom:6]; 

mapView_ = [GMSMapView mapWithFrame:CGRectMake(0, 0, 320, 320) camera:camera]; // crashing here 
mapView_.myLocationEnabled = YES; 
[self.view addSubview:mapView_]; 

// Creates a marker in the center of the map. 
GMSMarker *marker = [[GMSMarker alloc] init]; 
marker.position = CLLocationCoordinate2DMake(-33.86, 151.20); 
marker.title = @"Sydney"; 
marker.snippet = @"Australia"; 
marker.map = mapView_; 

} 
+0

mapView_은 viewController의 IBOutlet입니까? 그럴 경우 해당 행을 제거하고 mapView_.camera = camera;를 추가하십시오. – Ricky

+0

@ Ricky- IBOutlet을 사용하지 않았습니다. – iOS

+0

View Controller의 전체 코드를 보여주십시오. 질문을 편집하십시오. 가능하면 testFlight에 프로젝트를 업로드하고 여기에 링크하십시오. – Ricky

관련 문제