iphone - objc_msg发送崩溃:如何找到位置?

标签 iphone crash mkmapview

启用的nszombies
任何人都可以在此调试日志中看到的其他信息可以用来查找问题吗?

(gdb) bt  
0  0x30b7eca4 in objc_msgSend ()  
1  0x36179302 in -[MKMapView annotationContainer:viewForAnnotation:] ()  
2  0x36178f94 in -[MKAnnotationContainerView _addViewForAnnotation:] ()  
3  0x361a2faa in -[MKAnnotationContainerView userLocationAnnotationWillShow] ()  
4  0x3619fcbe in -[MKMapView(UserPositioningInternal) _runPositioningChange] ()  
5  0x3619da8c in -[MKMapView(UserPositioningInternal) _startPositioningChange:] ()  
6  0x361a1050 in -[MKMapView(UserPositioningInternal) locationManagerUpdatedLocation:] ()  
7  0x365cff02 in -[NSObject(NSObject) performSelector:withObject:] ()  
8  0x3660d2f8 in -[NSArray makeObjectsPerformSelector:withObject:] ()  
9  0x36190808 in -[MKLocationManager _reportLocationStatus:] ()  
10 0x36191d72 in -[MKLocationManager _reportLocationSuccess] ()
11 0x361919cc in -[MKLocationManager locationManager:didUpdateToLocation:fromLocation:] ()  
12 0x33bfbc2c in -[CLLocationManager onClientEventLocation:] ()  
13 0x33bfbf48 in -[CLLocationManager onClientEvent:supportInfo:] ()  
14 0x33bfdd04 in OnClientEventInternal ()  
15 0x33bf57a2 in CLClientInvokeCallback ()  
16 0x33bf7c46 in CLClientHandleDaemonDataLocation ()  
17 0x33bf7d9c in CLClientHandleDaemonData ()  
18 0x3663070c in __CFMessagePortPerform ()    
19 0x36639a96 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()  
20 0x3663b83e in __CFRunLoopDoSource1 ()  
21 0x3663c60c in __CFRunLoopRun ()  
22 0x365ccec2 in CFRunLoopRunSpecific ()  
23 0x365ccdca in CFRunLoopRunInMode ()  
24 0x313c141e in GSEventRunModal ()  
25 0x313c14ca in GSEventRun ()  
26 0x33390d68 in -[UIApplication _run] ()  
27 0x3338e806 in UIApplicationMain ()  
28 0x000039ca in main (argc=1, argv=0x2fdff55c) at main.m:14    
(gdb) 

更新:
- (MKAnnotationView *)mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation
{


 MKAnnotationView* annView = nil;

    if ( [annotation isKindOfClass: [AnnotationItem class]] )
    {
        MKPinAnnotationView* pin = (MKPinAnnotationView*)[mapView dequeueReusableAnnotationViewWithIdentifier: kListingAnnotationIdentifier];

        if ( nil == pin )
        {
            pin = [[[MKPinAnnotationView alloc] initWithAnnotation: annotation reuseIdentifier: kListingAnnotationIdentifier] autorelease];
        }
        else
        {
            [pin setAnnotation: annotation];
        }

        pin.canShowCallout = YES;

        pin.pinColor = MKPinAnnotationColorGreen;


        UIImage* img = [UIImage imageNamed: @"logap.png"] ;
        pin.leftCalloutAccessoryView = [[[UIImageView alloc] initWithImage: img] autorelease];


        pin.rightCalloutAccessoryView = [UIButton buttonWithType: UIButtonTypeDetailDisclosure];

        annView = pin;

    }
    return annView;



}

最佳答案

当mapView试图显示(更改)用户位置时,调试日志将显示崩溃。用户位置是对MKUserLocation类的注释,如果该注释传递给mapView:viewForAnnotation的实现,则您的代码将返回指向nil的指针(即,它将返回一个名为MKAnnotationViewannView对象,其值设置为nil)。

因此,我怀疑您是在用户位置出现或在屏幕上移动时崩溃的,还是nil与“值设置为MKAnnotationViewnil对象”之间的差异可能在难以复制的时间突然对Cocoa产生了影响。尝试测试注释是否为MKUserLocation类,并在这种情况下显式返回nil

关于iphone - objc_msg发送崩溃:如何找到位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6680183/

相关文章:

c# - 基础对象类的多个数组

ios - 将导航栏添加到 Storyboard 中时,Xcode崩溃。

ios - 在 mkMapview 中显示注释的不同图像

iphone - MKMapKit。中心图显示所有 MKAnnotation

objective-c - 滚动 MKMapView 时淡出弹出窗口

ios - 全屏相机

javascript - React Native - 在真实设备上构建时出现 XCode 错误?

iphone - 自定义 UITableViewCell 中的自定义 UIView

iphone - cocoa 再次错误 134100 - (用于打开的模型与用于创建的模型不兼容...)

actionscript-3 - 如何检测 Adob​​e Flash 崩溃原因?