将Google Map SDK添加到iOS6时,将错误的无法识别的选择器发送到课堂 [英] error unrecognized selector sent to class while adding Google Map SDK to iOS6

查看:139
本文介绍了将Google Map SDK添加到iOS6时,将错误的无法识别的选择器发送到课堂的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个单一的视图应用程序,我按照链接
https://开发人员.google.com / maps / documentation / ios / start
将谷歌地图SDK添加到iOS6。
错误是:

This is a single view application and I followed the instruction given at link https://developers.google.com/maps/documentation/ios/start for adding google map SDK to iOS6. ERROR Is:

unrecognized selector sent to class 0xe2b0
2013-02-07 15:21:29.788 mapApp[2061:12e03] *** Terminating app due to uncaught exception     
'NSInvalidArgumentException', reason: '+[GMSCameraPosition    
cameraWithLatitude:longitude:zoom:]: unrecognized selector sent to class 0xe2b0'

AppDelegate.m

AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
   // Override point for customization after application launch.
    self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
    self.window.rootViewController = self.viewController;

   //initializing google map api key
   [GMSServices provideAPIKey:@"google's api key goes here"];

   [self.window makeKeyAndVisible];
   return YES;

}

ViewController.m



ViewController.m

#import "ViewController.h"
#import <GoogleMaps/GoogleMaps.h>
@interface ViewController ()

@end

@implementation ViewController
{
    GMSMapView *mapView;
}

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

   GMSCameraPosition *cam = [GMSCameraPosition cameraWithLatitude:13.0245231 
                                                        longitude:77.64072579999993                
                                                             zoom:6];

   mapView = [GMSMapView mapWithFrame:CGRectZero camera:cam];
   mapView.myLocationEnabled = YES;

   GMSMarkerOptions *options = [[GMSMarkerOptions alloc]init ];
   options.position = CLLocationCoordinate2DMake(13.025738,77.637809);
   options.title = @"ensign";
   options.snippet = @"kalyan nagar";

   [mapView addMarkerWithOptions:options];

}

main.m

#import <UIKit/UIKit.h>
#import <GoogleMaps/GoogleMaps.h>
int main(int argc, char *argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv,nil, NSStringFromClass([AppDelegate class]));
    }
}

在跟踪错误时,它显示在$来自 -viewDidLoad main.m 中的c $ c> return 执行第一行之后

While tracking the error it is showing at the return statement in main.m which comes from the method -viewDidLoad after executing the first line

GMSCameraPosition *cam = [GMSCameraPosition cameraWithLatitude:13.0245231 
                                                    longitude:77.64072579999993                
                                                         zoom:6];

它转义了其余的行。

推荐答案

-ObjC 添加到其他链接器标志.google.com / maps / documentation / ios / start#added_the_google_maps_sdk_for_ios_to_your_projectrel =noreferrer>说明

Did you add -ObjC to the Other Linker Flags, in step 7 of the instructions?

-
额外信息编辑:请注意 -ObjC 区分大小写。

-- Extra information edit: note that -ObjC is case sensitive.

这篇关于将Google Map SDK添加到iOS6时,将错误的无法识别的选择器发送到课堂的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆