我正在使用MKMapKit地圖。我添加了註釋,甚至提供了setCenterCoordinate和setRegion。我正在編譯使用iOS7.0,但我的設備有iOS6.1版本。當我捏緊輸入時,放大它會崩潰。 我試過運行儀器,但沒有看到任何內存問題。所有分配和泄漏都得到妥善處理。請任何人知道這是什麼問題?應用程序崩潰捏地圖輸入地圖
代碼提供註解:
NSMutableArray *arr = [[NSMutableArray alloc] init];
for(int i =0;i<[mListArr count];i++)
{
NSDictionary *theDict = [mListArr objectAtIndex:i];
CLLocationCoordinate2D annotationCoord;
annotationCoord.latitude = [[theDict objectForKey:kLatitudeKey] doubleValue];
annotationCoord.longitude = [[theDict objectForKey:kLongitudeKey] doubleValue];
MKPointAnnotation *annotation = [[MKPointAnnotation alloc] init];
annotation.coordinate = annotationCoord;
annotation.title = [theDict objectForKey:kAddressKey];
annotation.subtitle = [theDict objectForKey:kRegionKey];
[arr addObject:annotation];
}
if([arr count]>0)
{
[mapView addAnnotations:arr];
NSDictionary *theDict = [mListArr objectAtIndex:0];
CLLocationCoordinate2D annotationCoord;
annotationCoord.latitude = [[theDict objectForKey:kLatitudeKey] doubleValue];
annotationCoord.longitude = [[theDict objectForKey:kLongitudeKey] doubleValue];
[mapView setCenterCoordinate:annotationCoord animated:YES];
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(annotationCoord, 50000, 50000);
[mapView setRegion:[mapView regionThatFits:region] animated:YES];
}
提前感謝!
編輯: 我正在使用ARC。
編輯: 以下是日誌:
* thread #3: tid = 0x2803, 0x3af605d0 libsystem_kernel.dylib`kevent64 + 24, queue = 'com.apple.libdispatch-manager
frame #0: 0x3af605d0 libsystem_kernel.dylib`kevent64 + 24
frame #1: 0x3ae9bd26 libdispatch.dylib`_dispatch_mgr_invoke + 810
frame #2: 0x3ae97378 libdispatch.dylib`_dispatch_mgr_thread + 36
現在我正在在設備上運行後,以下日誌:
* thread #1: tid = 0x2403, 0x3791ae46 libGPUSupportMercury.dylib`gpus_ReturnGuiltyForHardwareRestart + 10, queue = 'com.apple.main-thread, stop reason = EXC_BAD_ACCESS (code=1, address=0x1)
frame #0: 0x3791ae46 libGPUSupportMercury.dylib`gpus_ReturnGuiltyForHardwareRestart + 10
frame #1: 0x3791b764 libGPUSupportMercury.dylib`gpusSubmitDataBuffers + 124
frame #2: 0x330af5e4 IMGSGX543RC2GLDriver`SubmitPacketsIfAny + 244
frame #3: 0x3550e37a GLEngine`gliPresentViewES + 206
frame #4: 0x35516df2 OpenGLES`-[EAGLContext presentRenderbuffer:] + 74
frame #5: 0x39cf8596 VectorKit`-[VGLScreenCanvas didDrawView] + 54
frame #6: 0x39cf855c VectorKit`-[VKScreenCanvas didDrawView] + 60
frame #7: 0x39cf84a6 VectorKit`-[VKMapCanvas didDrawView] + 42
frame #8: 0x39cef838 VectorKit`-[VKScreenCanvas onTimerFired:] + 1124
frame #9: 0x39ced808 VectorKit`-[VKMapCanvas onTimerFired:] + 500
frame #10: 0x39cec6a6 VectorKit`-[VKMainLoop displayTimerFired:] + 614
frame #11: 0x35ca07a8 QuartzCore`CA::Display::DisplayLink::dispatch(unsigned long long, unsigned long long) + 160
frame #12: 0x35ca0700 QuartzCore`CA::Display::IOMFBDisplayLink::callback(__IOMobileFramebuffer*, unsigned long long, unsigned long long, unsigned long long, void*) + 64
frame #13: 0x37f1cfd6 IOMobileFramebuffer`IOMobileFramebufferVsyncNotifyFunc + 154
frame #14: 0x34c935ac IOKit`IODispatchCalloutFromCFMessage + 192
frame #15: 0x3407588a CoreFoundation`__CFMachPortPerform + 118
frame #16: 0x340803e6 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 34
frame #17: 0x3408038a CoreFoundation`__CFRunLoopDoSource1 + 138
frame #18: 0x3407f20e CoreFoundation`__CFRunLoopRun + 1382
frame #19: 0x33ff223c CoreFoundation`CFRunLoopRunSpecific + 356
frame #20: 0x33ff20c8 CoreFoundation`CFRunLoopRunInMode + 104
frame #21: 0x37bd133a GraphicsServices`GSEventRunModal + 74
frame #22: 0x35f0e2b8 UIKit`UIApplicationMain + 1120
frame #23: 0x00134928 AppName`main(argc=1, argv=0x2fd1fd08) + 116 at main.m:16
frame #24: 0x3c1d3b20 libdyld.dylib`start + 4
什麼是錯誤信息? – Larme
沒有錯誤信息。它顯示了主要的EXC_BAD_ACCESS。 –
使用NSZombies來幫助你知道你想訪問的對象不存在(已經存在)。 – Larme