我正在使用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
答案 0 :(得分:0)
您应该在xcode中设置异常断点,当应用崩溃时,您将可以访问lldb控制台以获取bt
的回溯,这可能非常有用。