1

バージョン 6.1 を実行する iPhone アプリケーションを作成しました。私のビューの 1 つで、注釈ピン、位置へのズームを含むマップビューを使用しています。

他のすべてのビューが最初に開かれ、マップビューがクラッシュしない場合、アプリは正常に動作します。ただし、アプリを開いてmapview viewcontrollerに直接アクセスすると、アプリがクラッシュしますか??

さらに、アプリは私の iPhone 4S デバイスでのみクラッシュし、コントローラーではクラッシュしませんか???

誰でも私を助けてもらえますか??

よろしくお願いします。

マップビューのコードは次のとおりです。

    @interface VisPaaKortViewController ()

@end

@implementation VisPaaKortViewController
@synthesize mapView;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.mapView.delegate = self;
    mapView.showsUserLocation = YES;




    // Do any additional setup after loading the view.


    // Create a view of the standard size at the top of the screen.
    // Available AdSize constants are explained in GADAdSize.h.
    bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];

    // Specify the ad's "unit identifier". This is your AdMob Publisher ID.
    bannerView_.adUnitID = @"my_publisher_id";

    // Let the runtime know which UIViewController to restore after taking
    // the user wherever the ad goes and add it to the view hierarchy.
    bannerView_.rootViewController = self;
    [self.view addSubview:bannerView_];


    //Placement of banner
    [bannerView_ setFrame:CGRectMake(0,
                                     362,
                                     bannerView_.bounds.size.width,
                                     bannerView_.bounds.size.height)];



    // Initiate a generic request to load it with an ad.
    [bannerView_ loadRequest:[GADRequest request]];


}


-(void) viewWillAppear:(BOOL)animated {
    [self performSelector:@selector(zoomInToMyLocation)
               withObject:nil
               afterDelay:0];
}





- (void)zoomInToMyLocation
{


    CLLocationCoordinate2D location;
    location.latitude = (double) 59.778747;
    location.longitude = (double) 9.292349;



    MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(location, 800, 800);
    [self.mapView setRegion:[self.mapView regionThatFits:region] animated:NO];


    // Add an annotation
    MKPointAnnotation *point = [[MKPointAnnotation alloc] init];
    point.coordinate = location;
    point.title = @"Text";
    point.subtitle = @"Text";

    [self.mapView addAnnotation:point];
    [self.mapView selectAnnotation:[[self.mapView annotations] objectAtIndex:0] animated:YES];

}

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

1 に答える 1