2014-04-19 2 views
1

iOS7 용 앱에 Google Maps API를 설치하려고합니다. Google의 가이드 라인 및 동영상을 따른 후 다음 오류로 끝났습니다. [GMSMapView animateToCameraPosition:]: unrecognized selector sent to instance 0x10b98e6c0Google지도 animateToCameraPosition iOS7 문제

Storyboard를 사용하고 있으며이지도를 동일한 viewController의 TableView 위에 표시하려고합니다.

이 응용 프로그램에서는 데이터를 TableView로 가져 오는 Parse를 사용하며 정상적으로 작동합니다.

이 난에 유래에 여기 몇 가지 제안을 사용하려고했으나 문제가 계속 :

: 분명히 문제가이 방법과 관련이

Cannot put a google maps GMSMapView in a subview of main main view?

How to set the frame for mapview - in google GMSMap for iOS6

mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera]; 

내가 지울 때 오류 g 멀리의 oes.

내 TestViewController 아래와 같이 코딩 (아무 테이블이나 뭐,하지만 여전히 작동하지 않습니다)입니다 :

// TesteViewController.m 

// 



#import "TesteViewController.h" 
#import <GoogleMaps/GoogleMaps.h> 
#import "AppDelegate.h" 

@interface TesteViewController() 

@end 

@implementation TesteViewController{ 
    GMSMapView *mapView_; 
} 

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 
{ 
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 
    if (self) { 
     // Custom initialization 
    } 
    return self; 
} 

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    // Do any additional setup after loading the view. 


    // Create a GMSCameraPosition that tells the map to display the 
    GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86 
                  longitude:151.20 
                   zoom:6]; 
    mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera]; 
    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_; 




} 



- (void)didReceiveMemoryWarning 
{ 
    [super didReceiveMemoryWarning]; 
    // Dispose of any resources that can be recreated. 
} 



@end 

나는 모든 프레임 워크를 수입, 권장, 성공하지 않고, 내 otherLinkerFlags-ObjC를 넣어 않았다.

그 외에도 새로운 빈 프로젝트에서 사용하고있는 프로세스를 테스트했지만 정상적으로 작동했지만 원래 프로젝트의 테스트와 마찬가지로 빈 viewController을 추가하려고하면 작동하지 않습니다.

내가했던 또 다른 테스트는이 빈 viewController에보기를 추가하고 위에서 게시 한 StackOverflow의 참조에서 언급 한 내용을 시도하는 것이 었습니다.

아무도 무슨 일이 일어나고 있는지에 대한 제안 사항이 있습니까?

아마도 Parse의 프레임 워크 나 다른 라이브러리와 충돌이 있습니까?

-ObjC을 사용하는 대신 -force_load $(PROJECT_DIR)/GoogleMaps.framework/GoogleMaps을 시도했지만 오류가 사라지고 현재 위치를 허용하도록 요청했지만 화면이로드되지 않습니다.

+0

viewDidLoad에서 뷰를 설정하지 마십시오! 그것이 바로 loadView의 일입니다. 따라서 맵 뷰 작성 코드를 loadView 메소드로 이동하십시오. – Felix

+0

@ phix23 loadView로 시도했지만 동일한 오류가 발생했습니다. 또한 viewWillLayoutSubviews 메서드로 이동하려고했지만 오류가 사라지지만 검은 색보기 만 있습니다. –

+0

충돌을 일으키는 코드는 어디에 두는 것입니까? 즉, [GMSMapView animateToCameraPosition :]? – Adam

답변

2

"대상"의 빌드 설정 대신 "프로젝트"빌드 설정에 -objC 플래그를 추가하면됩니다. 그것은이 방법으로 구글의 문서

**" Choose your project, rather than a specific target, and open the 
    Build Settings tab. In the Other Linker Flags section, add -ObjC. If 
    these settings are not visible, change the filter in the Build 
    Settings bar from Basic to All. "** 

에서 다음 절에서 언급 한 바와 같이

, 나는 Google지도 animateToCameraPosition :과 문제를 해결할 수 있었다.