更新到Xcode 5后的问题

时间:2013-12-17 19:07:15

标签: xcode ios7 xcode5

我的iOS应用程序在Xcode 4.6和iOS 6.1上完成了98%,并且工作正常。

但是当我尝试将我的Xcode更新到版本5并将SDK更新到iOS 7时,就会出现问题。

当我尝试在Xcode 5上运行应用程序但使用iOS 6.1时,它继续正常工作,但当我尝试在SDK 7上运行时,我遇到了以下问题:

2013-12-17 19:44:47.656 myAPP[2207:70b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<MKUserLocation 0x9d9af90> valueForUndefinedKey:]: this class is not key value coding-compliant for the key distanceAnnotation.'
*** First throw call stack:
(
    0   CoreFoundation                      0x01bf65e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x019798b6 objc_exception_throw + 44
    2   CoreFoundation                      0x01c866a1 -[NSException raise] + 17
    3   Foundation                          0x0142d8ca -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 282
    4   Foundation                          0x0139a921 _NSGetUsingKeyValueGetter + 81
    5   Foundation                          0x01399f5b -[NSObject(NSKeyValueCoding) valueForKey:] + 260
    6   Foundation                          0x013b9a5a -[NSObject(NSKeyValueCoding) valueForKeyPath:] + 409
    7   Foundation                          0x013c68c6 _sortedObjectsUsingDescriptors + 380
    8   Foundation                          0x013c66d7 -[NSMutableArray(NSKeyValueSorting) sortUsingDescriptors:] + 578
    9   myapp
                        0x00009e50 -[mapa mapViewDidFinishLoadingMap:] + 496
    10  MapKit                              0x0037e974 -[MKMapView mapViewDidFinishLoadingTiles:] + 78
    11  VectorKit                           0x050a3ade -[VKMapView mapDidFinishLoadingTiles:] + 78
    12  VectorKit                           0x050abe4e -[VKMapCanvas mapModelDidFinishLoadingTiles:] + 46
    13  VectorKit                           0x050b82cd -[VKMapModel didStopLoadingTilesWithError:] + 77
    14  VectorKit                           0x051ae2e1 -[VKTileProvider didStopLoadingTilesWithError:] + 49
    15  VectorKit                           0x051b1c99 -[VKTileSource didFinishWithNetwork] + 73
    16  VectorKit                           0x051c3aa3 __41-[VKResourcesTileSource performDownload:]_block_invoke73 + 51
    17  GeoServices                         0x04bb98a6 ___ZNK49-[GEOTileLoaderInternal _loadedTile:forKey:info:]66__49-[GEOTileLoaderInternal _loadedTile:forKey:info:]_block_invoke3$_1clERKN8LoadItem9RequesterE_block_invoke_2 + 85
    18  libdispatch.dylib                   0x021f77f8 _dispatch_call_block_and_release + 15
    19  libdispatch.dylib                   0x0220c4b0 _dispatch_client_callout + 14
    20  libdispatch.dylib                   0x021fa75e _dispatch_main_queue_callback_4CF + 340
    21  CoreFoundation                      0x01c5ba5e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
    22  CoreFoundation                      0x01b9c6bb __CFRunLoopRun + 1963
    23  CoreFoundation                      0x01b9bac3 CFRunLoopRunSpecific + 467
    24  CoreFoundation                      0x01b9b8db CFRunLoopRunInMode + 123
    25  GraphicsServices                    0x033579e2 GSEventRunModal + 192
    26  GraphicsServices                    0x03357809 GSEventRun + 104
    27  UIKit                               0x004dad3b UIApplicationMain + 1225
    28  FarmValencia                        0x000029ad main + 141
    29  libdyld.dylib                       0x0249e70d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

2 个答案:

答案 0 :(得分:0)

Theres根本没有足够的信息来正确调试此项目。

但我建议你为所有例外添加一个断点

以下是在XCode 4中添加All Exception断点的示例.XCode 5中的过程相同

http://www.alauda.ro/2013/02/03/xcode-4-exception-breakpoints/

除此之外,您可以尝试使用NSSetUncaughtExceptionHandler

http://www.cocoawithlove.com/2010/05/handling-unhandled-exceptions-and.html

这将允许您捕获错误并输出结果,但请记住,这是您应该只在调试期间执行的操作。

将它包装成“#if DEBUG”是一个好主意。

我希望这会帮助你。这些错误很难解决。

注意

您可以检查您使用的键值集是否在SDK的

之间没有变化

答案 1 :(得分:0)

您是否偶然将消息valueForUndefinedKey发送到类MKUserLocation?

以下是关于获取用户位置的类引用:

“MKUserLocation类定义了一种特定类型的注释,用于标识用户的当前位置。您不直接创建此类的实例。而是从应用程序中显示的地图视图的userLocation属性中检索现有的MKUserLocation对象。 。“

https://developer.apple.com/library/ios/documentation/MapKit/Reference/MKUserLocation_Class/Reference/Reference.html