iPhone 应用程序在 iOS 4.0 上崩溃

Posted

技术标签:

【中文标题】iPhone 应用程序在 iOS 4.0 上崩溃【英文标题】:iPhone app crash on iOS 4.0 【发布时间】:2011-04-20 20:15:18 【问题描述】:

为我们在 ios 4.0 上的应用程序提交的所有崩溃报告都提供以下信息:

Application Specific Information:
<my app name>[3532] was suspended with locked system files:
/private/var/mobile/Library/AddressBook/AddressBook.sqlitedb

知道这表明什么以及可能导致崩溃的原因是什么。我们的应用程序根本没有与 AddressBook.sqlitedb 交互。

完整的崩溃日志:

Exception Type:  00000020
Exception Codes: 0xdead10cc
Highlighted Thread:  0

Application Specific Information:
app name[3532] was suspended with locked system files: 
/private/var/mobile/Library/AddressBook/AddressBook.sqlitedb

Thread 0:
0   libobjc.A.dylib                 0x3302e4ac object_dispose
1   CoreFoundation                  0x31372cfe -[NSObject(NSObject) dealloc]
2   QuartzCore                      0x33e45264 -[CALayer dealloc]
3   QuartzCore                      0x33eb5e60 -[CALayer _dealloc]
4   QuartzCore                      0x33e3c752 CALayerRelease
5   QuartzCore                      0x33e3cd20 CA::release_root_if_unused(_CALayer*, _CALayer*, void*)
6   QuartzCore                      0x33e3ccbc x_hash_table_remove_if
7   QuartzCore                      0x33e3cb26 CA::Transaction::commit()
8   QuartzCore                      0x33e42406 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
9   CoreFoundation                  0x313caa42 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
10  CoreFoundation                  0x313cc46e __CFRunLoopDoObservers
11  CoreFoundation                  0x313cd774 __CFRunLoopRun
12  CoreFoundation                  0x313768e4 CFRunLoopRunSpecific
13  CoreFoundation                  0x313767ec CFRunLoopRunInMode
14  GraphicsServices                0x329f36e8 GSEventRunModal
15  GraphicsServices                0x329f3794 GSEventRun
16  UIKit                           0x316692a0 -[UIApplication _run]
17  UIKit                           0x31667e10 UIApplicationMain
18  app name                        0x00002a64 main + 36
19  app name                        0x00002a34 start + 32

Thread 1:
0   libSystem.B.dylib               0x35228c4c kevent + 24
1   libSystem.B.dylib               0x352d1e44 _dispatch_mgr_invoke
2   libSystem.B.dylib               0x352d1894 _dispatch_queue_invoke
3   libSystem.B.dylib               0x352d1a34 _dispatch_worker_thread2
4   libSystem.B.dylib               0x35275d82 _pthread_wqthread
5   libSystem.B.dylib               0x3526efcc start_wqthread + 0

Thread 2:
0   libSystem.B.dylib               0x351fc6b4 semaphore_wait_signal_trap + 8
1   libSystem.B.dylib               0x35229d92 semaphore_wait_signal
2   libSystem.B.dylib               0x351fe4a4 pthread_mutex_lock
3   WebCore                         0x30138194 _WebTryThreadLock(bool)
4   WebCore                         0x301380da WebRunLoopLock(__CFRunLoopObserver*, unsigned long, void*)
5   CoreFoundation                  0x313caa42 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
6   CoreFoundation                  0x313cc46e __CFRunLoopDoObservers
7   CoreFoundation                  0x313cd780 __CFRunLoopRun
8   CoreFoundation                  0x313768e4 CFRunLoopRunSpecific
9   CoreFoundation                  0x313767ec CFRunLoopRunInMode
10  WebCore                         0x30138056 RunWebThread(void*)
11  libSystem.B.dylib               0x35275986 _pthread_start
12  libSystem.B.dylib               0x3526b0e4 thread_start + 0

Thread 3:
0   libSystem.B.dylib               0x351fc658 mach_msg_trap + 20
1   libSystem.B.dylib               0x351fe724 mach_msg
2   CoreFoundation                  0x313cb2c8 __CFRunLoopServiceMachPort
3   CoreFoundation                  0x313cd582 __CFRunLoopRun
4   CoreFoundation                  0x313768e4 CFRunLoopRunSpecific
5   CoreFoundation                  0x313767ec CFRunLoopRunInMode
6   Foundation                      0x3329571e +[NSURLConnection(NSURLConnectionReallyInternal) _resourceLoadLoop:]
7   Foundation                      0x33265c96 -[NSThread main]
8   Foundation                      0x332ea9da __NSThread__main__
9   libSystem.B.dylib               0x35275986 _pthread_start
10  libSystem.B.dylib               0x3526b0e4 thread_start + 0

Thread 4:
0   libSystem.B.dylib               0x35220a20 select$DARWIN_EXTSN + 20
1   CoreFoundation                  0x313d0e70 __CFSocketManager
2   libSystem.B.dylib               0x35275986 _pthread_start
3   libSystem.B.dylib               0x3526b0e4 thread_start + 0

Thread 5:
0   libSystem.B.dylib               0x3527685c __workq_kernreturn + 8
1   libSystem.B.dylib               0x35275e98 _pthread_wqthread
2   libSystem.B.dylib               0x3526efcc start_wqthread + 0

Thread 6:
0   libSystem.B.dylib               0x3527685c __workq_kernreturn + 8
1   libSystem.B.dylib               0x35275e98 _pthread_wqthread
2   libSystem.B.dylib               0x3526efcc start_wqthread + 0

Thread 7:
0   libSystem.B.dylib               0x35205974 access + 8
1   libsqlite3.dylib                0x3282f5a6 unixAccess
2   libsqlite3.dylib                0x32826e5a sqlite3OsAccess
3   libsqlite3.dylib                0x32835bf0 sqlite3BtreeBeginTrans
4   libsqlite3.dylib                0x3284f038 sqlite3Step
5   libsqlite3.dylib                0x3282639c sqlite3_step
6   AppSupport                      0x31475634 CPSqliteStatementCopyStringResult
7   AppSupport                      0x3147626e CPSqliteConnectionCopyValueForProperty
8   AppSupport                      0x314773a2 CPSqliteDatabaseCopyValueForProperty
9   AppSupport                      0x314773ba CPSqliteDatabaseCopyUniqueIdentifier
10  AddressBook                     0x34dd7c3a ABCCreateAddressBookWithDatabaseDirectoryAndForceInProcessMigrationAndResetSortKeys
11  AddressBook                     0x34dd7eba ABCCreateAddressBookWithDatabaseDirectoryAndForceInProcessMigration
12  AddressBook                     0x34dd7ec8 ABCCreateAddressBookWithDatabaseDirectory
13  AddressBook                     0x34de3e78 ABAddressBookCreate
14  TextInput                       0x34973fb8 KB::matchable_strings_from_address_book()
15  TextInput                       0x34978686 KB::DynamicDictionaryImpl::background_load_address_book(KB::StaticDictionary const&)
16  TextInput                       0x34979d36 KB::BackgroundLoad(void*)
17  libSystem.B.dylib               0x35275986 _pthread_start
18  libSystem.B.dylib               0x3526b0e4 thread_start + 0

Unknown thread crashed with unknown flavor: 5, state_count: 1

Binary Images:
    0x1000 -    0x41fff +CVCrDVR armv6  <4ca92ed88199f56c60997ff21ed9963e> /var/mobile/Applications/6EF0091E-FE47-43B7-8515-08688A530869/CVCrDVR.app/CVCrDVR
   0xeb000 -    0xecfff  dns.so armv7  <240b8d3f07b4fcb234de598f8e67de1a> /usr/lib/info/dns.so
   0xf0000 -    0xf4fff  AccessibilitySettingsLoader armv7  <9e7d0552cedc18ba0b26cd182c47df8d> /System/Library/AccessibilityBundles/AccessibilitySettingsLoader.bundle/AccessibilitySettingsLoader
0x2fe00000 - 0x2fe26fff  dyld armv7  <193570c1391880df7da870149117e49e> /usr/lib/dyld
0x30135000 - 0x30686fff  WebCore armv7  <859bdd351085819fb4da07d12b41543f> /System/Library/PrivateFrameworks/WebCore.framework/WebCore
0x30ac5000 - 0x30adafff  libresolv.9.dylib armv7  <1ed920d5a995cd94e71c41631d7c551e> /usr/lib/libresolv.9.dylib
0x30adc000 - 0x30bc4fff  libGLProgrammability.dylib armv7  <9bcf5fe3e7abc344425e581ff2896579> /System/Library/Frameworks/OpenGLES.framework/libGLProgrammability.dylib
0x30ca5000 - 0x30d4bfff  WebKit armv7  <a1d04572b3214188f60f2d1961ac1fe8> /System/Library/PrivateFrameworks/WebKit.framework/WebKit
0x30eb4000 - 0x30f76fff  CFNetwork armv7  <9fdd61632fd1b48d65daba561528946f> /System/Library/Frameworks/CFNetwork.framework/CFNetwork
0x31297000 - 0x3129cfff  MobileKeyBag armv7  <d33678689445fcf1898314262fd1ebd3> /System/Library/PrivateFrameworks/MobileKeyBag.framework/MobileKeyBag
0x3129f000 - 0x312e7fff  libBLAS.dylib armv7  <3b4a2849c10d100a178a3c2d9f6af523> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libBLAS.dylib
0x312ea000 - 0x31358fff  ProofReader armv7  <479bd40ac65cb7e6c3000d79d649571f> /System/Library/PrivateFrameworks/ProofReader.framework/ProofReader
0x31359000 - 0x3142bfff  CoreFoundation armv7  <17c9c36ae8824496b507446869cd4d9d> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x31472000 - 0x314a0fff  AppSupport armv7  <2a64271b39599b2180d0dfd3141027ee> /System/Library/PrivateFrameworks/AppSupport.framework/AppSupport
0x31663000 - 0x3280dfff  UIKit armv7  <6c767127e477e6ac7b7f083857ca8064> /System/Library/Frameworks/UIKit.framework/UIKit
0x32824000 - 0x32868fff  libsqlite3.dylib armv7  <36b9bc7d02e29c8d321dd0d7bf7e115e> /usr/lib/libsqlite3.dylib
0x3286b000 - 0x3286dfff  IOMobileFramebuffer armv7  <1fdf9182a63464743901526caf39240a> /System/Library/PrivateFrameworks/IOMobileFramebuffer.framework/IOMobileFramebuffer
0x329b6000 - 0x329ccfff  RawCamera armv7  <78168f60a21e67ce307c5ce30054dba6> /System/Library/CoreServices/RawCamera.bundle/RawCamera
0x329dc000 - 0x329e2fff  liblockdown.dylib armv7  <df3c6cea5e6848109a6e033e1d883320> /usr/lib/liblockdown.dylib
0x329e3000 - 0x329ebfff  libgcc_s.1.dylib armv7  <b8fc1381e87a55740d9ac66195039a63> /usr/lib/libgcc_s.1.dylib
0x329f0000 - 0x329fbfff  GraphicsServices armv7  <7194df9e594ae0fd9d9c600ccf456a08> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
0x329fc000 - 0x32a46fff  libstdc++.6.dylib armv7  <baab09769f92decea73680bc15aa8618> /usr/lib/libstdc++.6.dylib
0x32ad3000 - 0x32ad5fff  libAccessibility.dylib armv7  <06dd6032c40b1feb094d63eeb2002d6d> /usr/lib/libAccessibility.dylib
0x32b17000 - 0x32b59fff  CoreTelephony armv7  <bc8796c8e011fea9923170d3c948a694> /System/Library/Frameworks/CoreTelephony.framework/CoreTelephony
0x32b98000 - 0x32b9bfff  IOSurface armv7  <e67242f81fd1c0fa5e84b3fae5d310ae> /System/Library/PrivateFrameworks/IOSurface.framework/IOSurface
0x32bb6000 - 0x32bb6fff  vecLib armv7  <85f89752df7814c1b243c26f59388523> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/vecLib
0x32bd1000 - 0x32bdbfff  ExternalAccessory armv7  <56a0856978d36be40c42834de8ab966d> /System/Library/Frameworks/ExternalAccessory.framework/ExternalAccessory
0x32de8000 - 0x32f06fff  CoreGraphics armv7  <4022bbf12f11dd1f6b75662c764e7f7c> /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics
0x32f20000 - 0x32f2dfff  DataDetectorsUI armv7  <8f6e03c382591e1f30f06e97b4b31570> /System/Library/PrivateFrameworks/DataDetectorsUI.framework/DataDetectorsUI
0x3302b000 - 0x330cbfff  libobjc.A.dylib armv7  <89553a61e05078fd178ac0ea2081ae40> /usr/lib/libobjc.A.dylib
0x3325a000 - 0x33379fff  Foundation armv7  <c985a61696030b4d1bdc8fe010f4e43b> /System/Library/Frameworks/Foundation.framework/Foundation
0x3337c000 - 0x3338efff  VoiceServices armv7  <f5b5b032e4c0b79c42e0fde5a59a6eb3> /System/Library/PrivateFrameworks/VoiceServices.framework/VoiceServices
0x3344f000 - 0x33489fff  IOKit armv7  <5e0169de165c2fd25a2ddac1f3e19d06> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
0x33641000 - 0x33680fff  libGLImage.dylib armv7  <b96f5e231a3e39677b5e3621d61d2f11> /System/Library/Frameworks/OpenGLES.framework/libGLImage.dylib
0x33681000 - 0x33683fff  MobileInstallation armv7  <74e2bd725da63513053b4fa41d8cd89c> /System/Library/PrivateFrameworks/MobileInstallation.framework/MobileInstallation
0x3368e000 - 0x3371bfff  ImageIO armv7  <abf07fc0430aaf2a2823753c78061aac> /System/Library/Frameworks/ImageIO.framework/ImageIO
0x33850000 - 0x33969fff  libicucore.A.dylib armv7  <c4f4fd74dfa672fb4d84914585bbada5> /usr/lib/libicucore.A.dylib
0x33c6f000 - 0x33c87fff  libRIP.A.dylib armv7  <436e3b257ba088ca6f773961ce619892> /System/Library/Frameworks/CoreGraphics.framework/Resources/libRIP.A.dylib
0x33c88000 - 0x33c8bfff  libGFXShared.dylib armv7  <12f82e44ff36b29f8d0661878be83554> /System/Library/Frameworks/OpenGLES.framework/libGFXShared.dylib
0x33c90000 - 0x33c9cfff  DataDetectorsCore armv7  <bc6bff5b67aae8b97a8cdd43ed7b0bb1> /System/Library/PrivateFrameworks/DataDetectorsCore.framework/DataDetectorsCore
0x33e36000 - 0x33edefff  QuartzCore armv7  <109b4f6a3d2ee5aa1bb5775ab5a489bc> /System/Library/Frameworks/QuartzCore.framework/QuartzCore
0x33ee2000 - 0x33f8bfff  libxml2.2.dylib armv7  <1d74fa3a5cec309857503a51cb2df667> /usr/lib/libxml2.2.dylib
0x34035000 - 0x342cffff  libLAPACK.dylib armv7  <fbc3f7ad1260a159d75be53218fa9e0c> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libLAPACK.dylib
0x343a8000 - 0x343b1fff  CoreVideo armv7  <58180e899ec56cd8bca00221dea2bc32> /System/Library/Frameworks/CoreVideo.framework/CoreVideo
0x343ee000 - 0x3442cfff  libvDSP.dylib armv7  <cc8d6be7a5021266e26ebd05e9579852> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libvDSP.dylib
0x3442d000 - 0x34435fff  libkxld.dylib armv7  <4ec35c4d1e1e73416aea84537829ce91> /usr/lib/system/libkxld.dylib
0x34438000 - 0x34445fff  OpenGLES armv7  <e397de408a0a789f816bc1803ae58faf> /System/Library/Frameworks/OpenGLES.framework/OpenGLES
0x344e8000 - 0x34521fff  MobileCoreServices armv7  <d38c937ae3548777da263d2657536189> /System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices
0x3456c000 - 0x3459bfff  CoreText armv7  <76eb1b63d684c3d21dba9e8129666d2f> /System/Library/Frameworks/CoreText.framework/CoreText
0x3459c000 - 0x345d2fff  Security armv7  <7cea1027f1a381b8d6c5ffae4dae0d22> /System/Library/Frameworks/Security.framework/Security
0x3473c000 - 0x347dbfff  javascriptCore armv7  <894df23ebbc4df713d9519141a61dd19> /System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore
0x347dc000 - 0x347ddfff  CoreSurface armv7  <042e433142b7faa4c96b23e555faaf13> /System/Library/PrivateFrameworks/CoreSurface.framework/CoreSurface
0x34844000 - 0x3484bfff  libbz2.1.0.dylib armv7  <5d079712f5a39708647292bccbd4c4e0> /usr/lib/libbz2.1.0.dylib
0x3487c000 - 0x348aafff  SystemConfiguration armv7  <2b44ac2fc47fc45c4006d08019688dbb> /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration
0x348ac000 - 0x348b7fff  libz.1.dylib armv7  <19a78978d5908bedc6496470fe542936> /usr/lib/libz.1.dylib
0x348e9000 - 0x34929fff  CoreAudio armv7  <1723726845b73efbeca75b33d75f335a> /System/Library/Frameworks/CoreAudio.framework/CoreAudio
0x3493e000 - 0x3496cfff  libCGFreetype.A.dylib armv7  <475259824770c6ff1b63f30238b3ea81> /System/Library/Frameworks/CoreGraphics.framework/Resources/libCGFreetype.A.dylib
0x3496d000 - 0x349a3fff  TextInput armv7  <949f29588014140b606042685de1dee6> /System/Library/PrivateFrameworks/TextInput.framework/TextInput
0x349a4000 - 0x349c3fff  Bom armv7  <c73b68b11b2801cefbfbdb6328a7fcfb> /System/Library/PrivateFrameworks/Bom.framework/Bom
0x34dd5000 - 0x34e07fff  AddressBook armv7  <3dde743216bbf016019b59f821dda6e3> /System/Library/Frameworks/AddressBook.framework/AddressBook
0x34f43000 - 0x34f4ffff  SpringBoardServices armv7  <7624f0a9e197261f2df43edb86ba0256> /System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices
0x34f50000 - 0x34f5dfff  libbsm.0.dylib armv7  <27ad6b3a74ce1068586eabd6a553183f> /usr/lib/libbsm.0.dylib
0x34f5e000 - 0x34f64fff  IAP armv7  <42a87fc47e059f5a73dcff2227b9e0be> /System/Library/PrivateFrameworks/IAP.framework/IAP
0x3502d000 - 0x35151fff  AudioToolbox armv7  <802e4d5c449b69d9552809e5230baa84> /System/Library/Frameworks/AudioToolbox.framework/AudioToolbox
0x35156000 - 0x35156fff  Accelerate armv7  <f4c04cdfdb64d209828315cdd5b60bf9> /System/Library/Frameworks/Accelerate.framework/Accelerate
0x351fb000 - 0x35308fff  libSystem.B.dylib armv7  <3fcf32f3ad8ef745480b5b36efc41953> /usr/lib/libSystem.B.dylib

我们也尝试了 symbolicatecrash,但它没有指向任何地方。

感谢和问候, 赫塔尔

【问题讨论】:

你能提供更多的堆栈跟踪/调用堆栈吗? 我已将崩溃日志信息添加到问题中。请看看让我知道你是否可以从中推断出任何东西。 【参考方案1】:

您正在使用任何类型的文件吗? 好像你试图访问锁定的文件..

从Apple Developer Documentation阅读这篇文章

确定受保护文件的可用性 只有在设备解锁时才能访问受保护的文件。由于应用程序可能会在设备锁定时继续运行,因此您的代码应准备好处理受保护文件随时变得不可用的可能性。 UIKit 框架提供了跟踪当前是否启用数据保护的方法。

【讨论】:

在通过网络下载并使用这些图像后,我们正在将一些图像保存到文档目录。除此之外,我们正在从 NSUserDefaults 保存和检索数据。除此之外,我们没有其他文件访问权限。我在问题中包含更多堆栈跟踪。请看一下,如果这有助于推断出一些东西,请告诉我。 我记得有同样的错误......再次不确定它是否完全相同......但它即将到来,因为我刚刚获得了文件的读取权限......所以你可能会想尝试检查文件和文件夹的权限。 有同样的问题。不过奇怪的是,我从不写信给 ABAddressBook(除了通过 ABAddressBookUI 自己做的事情)。此外,只有 ABAddressBookCreate() 调用,没有任何东西可以显式关闭它(不保存)。我错过了什么吗? 我有同样的错误,我也这样做:我们正在将一些图像通过网络下载并使用它们后保存到文档目录。【参考方案2】:

崩溃日志表明,当您的应用暂停时,您的应用仍在访问地址簿。您的应用需要CFRelease 访问您的地址簿 applicationDidEnterBackground:委托方法。

【讨论】:

【参考方案3】:

Pat 和 Roi,如果您查看堆栈跟踪,您会发现您正在使用地址簿,分别在线程 5 和 7 中。也许您正在使用访问地址簿的 API? 我们遇到了这个问题,并且正在寻找一种在应用程序后台运行时向正在访问地址簿的后台线程发送消息的方法。当我们找到它时会更新这个帖子。

【讨论】:

以上是关于iPhone 应用程序在 iOS 4.0 上崩溃的主要内容,如果未能解决你的问题,请参考以下文章

在 iOS 4.0 上使用大图像时应用程序崩溃

ALAssetPropertyLocation 在 3gs iPhone 上无法在任何 iOS 4.0+ 上运行,但在 iPhone4 上完美运行

在 iOS 4.0 上释放 Autoreleasepool 崩溃(以及在 4.1 上......)

iOS 9 Ionic Cordova 应用程序在 iPhone 上崩溃;在 iPad 上工作

ios 6 iPhone window.rootViewController 崩溃

iOS 9 Safari webkit 仅在 iPad 上崩溃(iPhone 工作正常)