MKMapViewを使用していて、注釈ピンをマップに配置しています。私は30の異なる場所の地図に30ピンを配置するために取り組んでおり、それぞれの追加の場所を追加した後、iPhone SDKを確実に実行しました。それから、どこからも、それが崩壊し始め、私に恐ろしい「SIGABRT」を与え始めました。 AG !!MKMapViewで複数の注釈を試行するとSIGABRTエラーが発生する
私の構文では多少の間違いがあるかもしれないが、以前はうまく機能していたコードをコピーして貼り付けているので、私は迷っている。私はMKCoordinateRegionMakeを使用してすべてをより簡潔にすることを検討しています(これはオプションかもしれません)。しかし、すでに10店舗のようなものを入力していますので、それを切り替えるのに多くの時間がかかります。これが迅速な修正である場合は実行してください。
私は1つの座標を除いてすべてを取り出して機能しました。それから、もう1つを追加して、それがうまくいった。何らかの理由で、それは時代の束になったが、時にはロックアップしてクラッシュすることもあった。私はそれが問題であった特定の場所だと思ったが、特にどの場所の構文でも問題にはならなかったようだ。だから私はそれを引き起こしているもののために失っている。
私はこれが正しいとは言えないことを割り当てて解放することの問題かもしれないと思っていますか?コード中に割り当てられたスペースを「解放」しようとしましたが、問題は解決しませんでした。私はまた、コードの間に割り当てられたスペースを解放しないで、同じ問題を起こさせようとしました。
ここで私は(すべてのコードが時間で働いていたので、私は、タイトル、サブタイトルを設定し、正しくファイルMillersLocationsに座標ました)で働いているコードだ:
MapViewController.m
- (void)viewDidLoad
{
[super viewDidLoad];
//Miller's Neighborhood Market #56
MKCoordinateRegion store56;
store56.center.latitude = 36.8605679;
store56.center.longitude = -76.2866713;
store56.span.latitudeDelta = 0.1;
store56.span.longitudeDelta = 0.1;
[mapView setRegion:store56 animated:YES];
MillersLocations *ann56 = [[MillersLocations alloc]init];
ann56.title = @"Store #56";
ann56.subtitle = @"Come check us out!";
ann56.coordinate = store56.center;
[mapView addAnnotation:ann56];
[MillersLocations release];
//Not sure if release should be on this syntax
//Miller's Neighborhood Market #66
MKCoordinateRegion store66;
store66.center.latitude = 37.0942970;
store66.center.longitude = -76.4584890;
store66.span.latitudeDelta = 0.1;
store66.span.longitudeDelta = 0.1;
[mapView setRegion:store66 animated:YES];
MillersLocations *ann66 = [[MillersLocations alloc]init];
ann66.title = @"Store #66";
ann66.subtitle = @"Come check us out!";
ann66.coordinate = store66.center;
[mapView addAnnotation:ann66];
[MillersLocations release];
//Not sure if release should be on this syntax
//Miller's Neighborhood Market #21
MKCoordinateRegion store21;
store21.center.latitude = 37.0385289;
store21.center.longitude = -76.4004810;
store21.span.latitudeDelta = 0.1;
store21.span.longitudeDelta = 0.1;
[mapView setRegion:store21 animated:YES];
MillersLocations *ann21 = [[MillersLocations alloc]init];
ann21.title = @"Store #21";
ann21.subtitle = @"Come check us out!";
ann21.coordinate = store21.center;
[mapView addAnnotation:ann21];
[MillersLocations release];
//Not sure if release should be on this syntax
//Miller's Neighborhood Market #67
MKCoordinateRegion store67;
store67.center.latitude = 37.6823690;
store67.center.longitude = -77.5898330;
store67.span.latitudeDelta = 0.1;
store67.span.longitudeDelta = 0.1;
[mapView setRegion:store67 animated:YES];
MillersLocations *ann67 = [[MillersLocations alloc]init];
ann67.title = @"Store 67";
ann67.subtitle = @"Come check us out";
ann67.coordinate = store67.center;
[mapView addAnnotation:ann67];
[MillersLocations release];
//Not sure if release should be on this syntax
//Miller's Neighborhood Market #49
MKCoordinateRegion store49;
store49.center.latitude = 36.8550990;
store49.center.longitude = -76.1355950;
store49.span.latitudeDelta = 0.1;
store49.span.latitudeDelta = 0.1;
[mapView setRegion:store49 animated:YES];
MillersLocations *ann49 = [[MillersLocations alloc]init];
ann49.title = @"Store 49";
ann49.subtitle = @"Come check us out";
ann49.coordinate = store49.center;
[mapView addAnnotation:ann49];
[MillersLocations release];
//Not sure if release should be on this syntax
//Miller's Neighborhood Market #82
MKCoordinateRegion store82;
store82.center.latitude = 36.7848840;
store82.center.longitude = -76.1587459;
store82.span.latitudeDelta = 0.1;
store82.span.latitudeDelta = 0.1;
[mapView setRegion:store82 animated:YES];
MillersLocations *ann82 = [[MillersLocations alloc]init];
ann82.title = @"Store 82";
ann82.subtitle = @"Come check us out";
ann82.coordinate = store82.center;
[mapView addAnnotation:ann82];
[MillersLocations release];
//Not sure if release should be on this syntax
//Miller's Neighborhood Market #40
MKCoordinateRegion store40;
store40.center.latitude = 37.1236680;
store40.center.longitude = -76.5093960;
store40.span.latitudeDelta = 0.1;
store40.span.latitudeDelta = 0.1;
[mapView setRegion:store40 animated:YES];
MillersLocations *ann40 = [[MillersLocations alloc]init];
ann40.title = @"Store 40";
ann40.subtitle = @"Come check us out";
ann40.coordinate = store40.center;
[mapView addAnnotation:ann40];
[MillersLocations release];
//Not sure if release should be on this syntax
//Miller's Neighborhood Market #55
MKCoordinateRegion store55;
store55.center.latitude = 36.7704630;
store55.center.longitude = -76.6058140;
store55.span.latitudeDelta = 0.1;
store55.span.latitudeDelta = 0.1;
[mapView setRegion:store55 animated:YES];
MillersLocations *ann55 = [[MillersLocations alloc]init];
ann55.title = @"Store 55";
ann55.subtitle = @"Come check us out";
ann55.coordinate = store55.center;
[mapView addAnnotation:ann55];
[MillersLocations release];
//Not sure if release should be on this syntax
//Miller's Neighborhood Market #58
MKCoordinateRegion store58;
store58.center.latitude = 36.7818390;
store58.center.longitude = -76.0479090;
store58.span.latitudeDelta = 0.1;
store58.span.latitudeDelta = 0.1;
[mapView setRegion:store58 animated:YES];
MillersLocations *ann58 = [[MillersLocations alloc]init];
ann58.title = @"Store 58";
ann58.subtitle = @"Come check us out";
ann58.coordinate = store58.center;
[mapView addAnnotation:ann58];
[MillersLocations release];
//Not sure if release should be on this syntax
//Miller's Neighborhood Market #57
MKCoordinateRegion store57;
store57.center.latitude = 36.8216160;
store57.center.longitude = -76.4246680;
store57.span.latitudeDelta = 0.1;
store57.span.latitudeDelta = 0.1;
[mapView setRegion:store57 animated:YES];
MillersLocations *ann57 = [[MillersLocations alloc]init];
ann57.title = @"Store 57";
ann57.subtitle = @"Come check us out";
ann57.coordinate = store57.center;
[mapView addAnnotation:ann57];
[MillersLocations release];
//Not sure if release should be on this syntax
//Miller's Neighborhood Market #90
MKCoordinateRegion store90;
store90.center.latitude = 38.1330690;
store90.center.longitude = -77.5124230;
store90.span.latitudeDelta = 0.1;
store90.span.latitudeDelta = 0.1;
[mapView setRegion:store90 animated:YES];
MillersLocations *ann90 = [[MillersLocations alloc]init];
ann90.title = @"Store 90";
ann90.subtitle = @"Come check us out";
ann90.coordinate = store90.center;
[mapView addAnnotation:ann90];
[MillersLocations release];
//Not sure if release should be on this syntax
//56,66,21,67,49,90,82,40,55,58,57
}
エラー(スレッド1:プログラム受信信号 "SIGABRT")は常に次の行で発生します。
[mapView setRegion:store57 animated:YES];
またはストア90でも。そこに起こった他の店もありますが、常にその行にあります。私が決めた韻や理由はありません。
お手伝いいただける方に感謝します。私が少し長めになったらお詫び申し上げます。私はあなたが助けてくれる情報が含まれていることを確認したかっただけです。 (「[MapViewのリリース];」)それは働いた
EDITは、かつて私が正しく、私が作成し、それを解放するために、コードの得たことMKMapViewアウトレットを合成しました。私はMapViewsがエラーの原因となっていたはずだと仮定しています。
それは正常に機能し、別の注釈を追加しようとしましたが、もう一度クラッシュしました。新しい注釈を削除すると機能しますので、追加すると問題が発生します。 AG。どんな助けもありがとうございます。ありがとう。
うわー、ありがとうございます。私は、latitudeDelta問題の文法エラーを見落としたとは思えません。そのような大きな助けは、本当にそれを感謝します。 – MillerMedia
また、このポストを読んでいる人は、CLLocationCoordinate2Makeを使用するためにCoreLocations Frameworkを追加してインポートする必要があります。 – MillerMedia