Search code examples
iphoneobjective-cios4iphone-sdk-3.0

UIMapkit Implementation issue


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: could 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


Solution

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