【问题标题】:UIMapkit Implementation issueUIMapkit 实现问题
【发布时间】:2011-04-14 14:16:53
【问题描述】:

我已经安装了应用程序。在 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] 共享库应用加载规则全部 继续 程序接收信号:“EXC_BAD_ACCESS”。 警告:check_safe_call:无法恢复当前帧

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

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

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

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

【问题讨论】:

  • 发布崩溃日志及相关代码...
  • 从设备添加日志。

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


【解决方案1】:

检查您是否正在使用 3.2 操作系统中不可用的某些功能,例如地图覆盖是在 OS4.0 中引入的...

【讨论】:

    猜你喜欢
    • 2011-07-22
    • 2010-10-15
    • 2011-01-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多