2

Google Maps SDK for iOS - Getting startedのリンクに記載されている手順に従いました。以下は私が作成したファイルです

AppDelegate.m

#import "AppDelegate.h"
#import "ViewController.h"

@implementation AppDelegate

- (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];
    [GMSServices provideAPIKey:@"AIzaXXXXXXXXXXeGuCyxChdTECXXXXXXXXXXV9E"];
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];

    return YES;
}
//Other functions are there as it is.

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.
}

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

- (void)loadView 
{
    // Create a GMSCameraPosition that tells the map to display the
    // coordinate -33.86,151.20 at zoom level 6.
    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_;
}

@end

main.m

#import <UIKit/UIKit.h>

#import "AppDelegate.h"

int main(int argc, char *argv[])
{
    @autoreleasepool 
    {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
        //Error is displayed in the above line.
    }
}

以下、エラーの詳細です

2013-04-23 17:02:37.482 GMap[8146:12e03] +[GMSCameraPosition cameraWithLatitude:longitude:zoom:]: unrecognized selector sent to class 0x25ad5c
2013-04-23 17:02:37.483 GMap[8146:12e03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[GMSCameraPosition cameraWithLatitude:longitude:zoom:]: unrecognized selector sent to class 0x25ad5c'
*** First throw call stack:
(0x2418012 0x223de7e 0x24a32ad 0x2407bbc 0x240794e 0x2bb4 0x1262ff8 0x1263232 0x11b23d5 0x11b276f 0x11b2905 0x11bb917 0x27ad 0x117f157 0x117f747 0x118094b 0x1191cb5 0x1192beb 0x1184698 0x3133df9 0x3133ad0 0x238dbf5 0x238d962 0x23bebb6 0x23bdf44 0x23bde1b 0x118017a 0x1181ffc 0x24bd 0x23e5)
libc++abi.dylib: terminate called throwing an exception
4

1 に答える 1

2

エラーは次のとおりです。

'+[GMSCameraPosition cameraWithLatitude:longitude:zoom:]: 認識されないセレクターがクラス 0x25ad5c に送信されました'

定義されていると思われるSDKによると。それはどのように定義されていますか?カテゴリの場合は、フラグ -ObjC および -all_load を使用して SDK にリンクする必要がある場合があります。

于 2013-04-23T12:07:53.567 に答える