map - 将 Google Map SDK 添加到 iOS6 时将错误无法识别的选择器发送到类

标签 map sdk ios6 google-maps-sdk-ios

这是一个单 View 应用程序,我按照链接中给出的说明进行操作
https://developers.google.com/maps/documentation/ios/start
用于将谷歌地图 SDK 添加到 iOS6。
错误是:

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
- (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;

}

View Controller .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];

}

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

在跟踪它在 return 上显示的错误时main.m 中的声明来自方法-viewDidLoad执行第一行后
GMSCameraPosition *cam = [GMSCameraPosition cameraWithLatitude:13.0245231 
                                                    longitude:77.64072579999993                
                                                         zoom:6];

它逃脱了其余的行。

最佳答案

是否添加了 -ObjC到其他链接器标志,在the instructions 的步骤7 中?

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

关于map - 将 Google Map SDK 添加到 iOS6 时将错误无法识别的选择器发送到类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14748986/

相关文章:

objective-c - 为什么 iOS SDK 和 iOS 操作系统版本会相互影响?或者 : What IS an iOS SDK?

iphone - 从视频中获取缩略图总是返回 null

将单字符串向量映射到 PersistentMap

FileInputFormat,其中文件名是 KEY,文本内容是 VALUE

具有交互和映射的 Haskell IO

java - Java可以使用String作为索引数组键吗? (例如 : array ["a"]=1;)

c++ - InitializeCriticalSectionEx 不是 atlwinverapi.h 中全局命名空间的成员

android - SDK39 上未处理的 promise 拒绝 - SplashScreen

ios - 如何使用引脚和间距使界面保持在屏幕中央,与屏幕尺寸无关

objective-c - UIImageView 在 UICollectionViewCell 子类中显示图像越界