应用程序在Xcode中显示mapView时崩溃

时间:2013-11-26 09:54:55

标签: xcode ios7 mkmapview

我已经创建了一个选项卡式应用程序,其中一个选项卡是带有地图视图的视图控制器。应用程序中的另一个选项卡工作正常,但当我尝试切换到带有mapView的选项卡时,它崩溃了。我目前已将mapView设置为显示用户的当前位置。请让我知道我哪里出错了。下面是带有地图视图的视图控制器的代码。

SecondViewcontroller.h

#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import <CoreLocation/CoreLocation.h>

@interface SecondViewController : UIViewController <MKMapViewDelegate>

@property (weak, nonatomic) IBOutlet MKMapView *mapView;

@end

SecondViewcontroller.m

#import "SecondViewController.h"

@interface SecondViewController () 

 @end

@implementation SecondViewController

 - (void)viewDidLoad
 {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[_mapView setDelegate:self];
[self.mapView setShowsUserLocation:YES];
 }


 -(void)viewWillDisappear:(BOOL)animated
  {
[_mapView setShowsUserLocation:NO];
 }

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


 @end

崩溃报告的图像 enter image description here

0 个答案:

没有答案