Mapkit实施问题

时间:2011-04-14 14:16:54

标签: iphone objective-c ios4 iphone-sdk-3.0

我已安装该应用。在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 继续 程序接收信号:“EXC_BAD_ACCESS”。 警告:check_safe_call:无法恢复当前帧

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

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

警告:无法恢复以前选择的框架。 警告:无法恢复以前选择的帧。 警告:无法恢复以前选择的帧。 杀 退出

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

1 个答案:

答案 0 :(得分:0)

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