我尝试使用Google Map SDK创建Google地图。
我添加了Google& amp;提到的所有库。还实现了示例代码
AppDelegate中的[GMSServices provideAPIKey:@"AIzaSyAEu3QMEC5-KdE1VdLw8K2u-z6dZqXLvzw"];
并且
@implementation ViewController{
GMSMapView *mapView_;
}
and
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_;`
ViewController.m文件中的。并且还在项目的buildphases文件中添加了-ObjC
仍然得到相同的错误,即-[GMSMapView animateToCameraPosition:]: unrecognized selector sent
。
这是跟踪
`2014-12-24 16:40:36.635 YourLocalBookShop[2501:188298] -[GMSMapView animateToCameraPosition:]: unrecognized selector sent to instance 0x7aedd350
2014-12-24 16:40:36.659 YourLocalBookShop[2501:188298] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GMSMapView animateToCameraPosition:]: unrecognized selector sent to instance 0x7aedd350'
*** First throw call stack:
(
0 CoreFoundation 0x02139946 __exceptionPreprocess + 182
1 libobjc.A.dylib 0x01dc2a97 objc_exception_throw + 44
2 CoreFoundation 0x021415c5 -[NSObject(NSObject) doesNotRecognizeSelector:] + 277
3 CoreFoundation 0x0208a3e7 ___forwarding___ + 1047
4 CoreFoundation 0x02089fae _CF_forwarding_prep_0 + 14
5 YourLocalBookShop 0x00235772 -[GMSMapView setCamera:] + 187
6 YourLocalBookShop 0x00233b01 -[GMSMapView sharedInitWithServices:camera:] + 2029
7 YourLocalBookShop 0x00232cb5 -[GMSMapView initWithFrame:camera:] + 122
8 YourLocalBookShop 0x00232b66 +[GMSMapView mapWithFrame:camera:] + 93
9 YourLocalBookShop 0x000923f7 -[ViewController viewDidLoad] + 247
10 UIKit 0x028582a4 -[UIViewController loadViewIfRequired] + 771
11 UIKit 0x02858595 -[UIViewController view] + 35
12 UIKit 0x0274f825 -[UIWindow addRootViewControllerViewIfPossible] + 66
13 UIKit 0x0274fc99 -[UIWindow _setHidden:forced:] + 287
14 UIKit 0x0274ff50 -[UIWindow _orderFrontWithoutMakingKey] + 49
15 UIKit 0x0275e28d -[UIWindow makeKeyAndVisible] + 80
16 UIKit 0x026fb776 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3108
17 UIKit 0x026fec0d -[UIApplication _runWithMainScene:transitionContext:completion:] + 1639
18 UIKit 0x027177d0 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke + 59
19 UIKit 0x026fd81f -[UIApplication workspaceDidEndTransaction:] + 155
20 FrontBoardServices 0x066f99de __37-[FBSWorkspace clientEndTransaction:]_block_invoke_2 + 71
21 FrontBoardServices 0x066f946f __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 54
22 FrontBoardServices 0x0670b425 __31-[FBSSerialQueue performAsync:]_block_invoke + 26
23 CoreFoundation 0x0205d1c0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 16
24 CoreFoundation 0x02052ad3 __CFRunLoopDoBlocks + 195
25 CoreFoundation 0x0205292b __CFRunLoopRun + 2715
26 CoreFoundation 0x02051bcb CFRunLoopRunSpecific + 443
27 CoreFoundation 0x020519fb CFRunLoopRunInMode + 123
28 UIKit 0x026fd1e4 -[UIApplication _run] + 571
29 UIKit 0x027008b6 UIApplicationMain + 1526
30 YourLocalBookShop 0x00092afd main + 141
31 libdyld.dylib 0x03a4aac9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) `
答案 0 :(得分:0)
我已经尝试了Google开发者指南中提到的所有步骤,并且能够使其正常运行。我想我可能错过了某个地方添加列出的框架,或者可能错过了链接这些框架的某处