此错误仅出现在 Xcode 5.0 版中
在我在 Xcode版本 4.6.2中创建我的应用程序之前,它对我来说工作得很好,但是我在 Xcode版本 5.0中遇到了这个错误
我创建了自定义注释类来生成我更新的位置和地址。
我的代码是:
注释视图.h
#import <MapKit/MapKit.h>
@interface AnnotationView : MKPlacemark
@property (nonatomic, readwrite, assign) CLLocationCoordinate2D coordinate;
@property (nonatomic, strong) NSString *title;
@property (nonatomic, strong) NSString *subtitle;
@end
注释视图.m
#import "AnnotationView.h"
@implementation AnnotationView
- (id)initWithCoordinate:(CLLocationCoordinate2D)coordinate addressDictionary:(NSDictionary *)addressDictionary
{
if ((self = [super initWithCoordinate:coordinate addressDictionary:addressDictionary]))
{
self.coordinate = coordinate;
}
return self;
}
@end
以上是我的自定义类。我在我的 MapView 中使用了它。
CLLocationCoordinate2D theCoordinate ;
theCoordinate.latitude = [self.latitude doubleValue];
theCoordinate.longitude = [self.longitude doubleValue];
AnnotationView *annotation = [[AnnotationView alloc] initWithCoordinate:theCoordinate addressDictionary:nil] ;
annotation.title = self.businessName;
annotation.subtitle = self.businessAddress;
[self.mapView addAnnotation:annotation];
MKCoordinateRegion adjustedRegion = [self.mapView regionThatFits:MKCoordinateRegionMakeWithDistance(theCoordinate, 8000, 8000)];
[self.mapView setRegion:adjustedRegion animated:YES];
请建议我在哪里犯错。