Mapkit实施问题

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mapkit实施问题相关的知识,希望对你有一定的参考价值。

我已安装该应用程序。在ios 4.2中,地图完成了工作,但这个应用程序在ios 3.2中崩溃了。我能做什么?

#import "customAnnotation.h"


@implementation customAnnotation
@synthesize coordinate, titletext, subtitletext;

-(id)initWithCoordinate:(CLLocationCoordinate2D)coords{

    coordinate = coords;
    NSLog(@"%f,%f",coords.latitude,coords.longitude);
    return self;
}


- (NSString *)subtitle{
    return self.subtitletext;
}
- (NSString *)title{
    return self.titletext;
}

-(void)setTitle:(NSString*)strTitle {  
    self.titletext = strTitle;  
}  

-(void)setSubTitle:(NSString*)strSubTitle {  
    self.subtitletext = strSubTitle;  
}  
-(void)dealloc {
    [titletext release];
    [subtitletext release];
    [super dealloc];

}

@end

in custom annotation class

and other class code is here


#import "MapExampleViewController.h"

@implementation MapExampleViewController


-(void)createAnnotationWithCoords:(CLLocationCoordinate2D)coords{

    customAnnotation *annotation = [[customAnnotation alloc] initWithCoordinate:coords];
    //annotation.title = @"Gandhinagar";
    //annotation.subtitle = @"Indroda Park";

    [annotation setTitle:@"Main Title"];
    [annotation setSubTitle:@"Sub Title"];

    [myMapView addAnnotation:annotation];
    [annotation release];

}


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {

    [super viewDidLoad];
    myMapView = [[MKMapView alloc] initWithFrame:[self.view bounds]];   
    CLLocationCoordinate2D coords = CLLocationCoordinate2DMake(23.216667, 72.683333);
    float zoomLevel = 0.2;
    MKCoordinateRegion region = MKCoordinateRegionMake(coords, MKCoordinateSpanMake(zoomLevel, zoomLevel));
    [myMapView setRegion:[myMapView regionThatFits:region] animated:YES];
    myMapView.delegate = self;
    [self createAnnotationWithCoords:coords];
    [self.view addSubview:myMapView];

}

当我安装应用程序时。在ios 3.2中,它给出了以下错误

[切换到线程11779] [切换到线程11779] sharedlibrary apply-load-rules all continue程序接收信号:“EXC_BAD_ACCESS”。警告:check_safe_call:无法恢复当前帧

警告:check_safe_call:无法恢复当前帧

警告:无法恢复以前选择的帧。警告:check_safe_call:无法恢复当前帧

警告:无法恢复以前选择的帧。警告:无法恢复以前选择的帧。警告:无法恢复以前选择的帧。杀死了

调试器已退出状态0.(gdb)请帮忙!谢谢

答案

检查您是否使用了3.2 OS中没有的某些功能,例如OS4.0中引入了地图叠加...

以上是关于Mapkit实施问题的主要内容,如果未能解决你的问题,请参考以下文章

我实施滑动标签有什么问题?

活动与片段实施

为啥这个片段不起作用?断开的模型没有被实施

iPhone MapKit 错误

MapKit 的注释问题

核心位置,MapKit 错误