开发者

UIMapkit Implementation issue

开发者 https://www.devze.com 2023-02-24 10:50 出处:网络
I have install the app. in ios 4.2 then the map is complete working but this app is crashed in ios 3.2.

I have install the app. in ios 4.2 then the map is complete working but this app is crashed in ios 3.2. What can i do?

#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];

}

when I am install the app. in ios 3.2 then it gives below error

[Switching to thread 11779] [Switching to thread 11779] sharedlibrary apply-load-rules all continue Program received signal: “EXC_BAD_ACCESS”. warning: check_safe_call: could not restore current frame

warning: check_safe_call: could not restore current frame

warning: Unable to restore previously selected frame. warning: check_safe_call: coul开发者_StackOverflow中文版d not restore current frame

warning: Unable to restore previously selected frame. warning: Unable to restore previously selected frame. warning: Unable to restore previously selected frame. kill quit

The Debugger has exited with status 0.(gdb) please help! thanks


Check if you're using some functions that are not available in 3.2 OS, e.g. map overlays were introduced in OS4.0...

0

精彩评论

暂无评论...
验证码 换一张
取 消