我的原生iOS应用程序中出现了崩溃(在模拟器上运行正常,只在设备上出错)我无法识别问题。在显示初始视图控制器之前,在显示启动画面时发生崩溃。以下是我迄今为止所做的3个步骤:
1)打开所有异常断点。通过这样做,异常显示在main.m中。这是代码:
// main.m
#import <UIKit/UIKit.h>
#import "idcAppDelegate.h"
int main(int argc, char * argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([idcAppDelegate class]));
}
}
2)查看崩溃日志并对其进行了符号化。这是输出。崩溃报告(下面)第5行中显示的唯一视图控制器是EngineeringViewController.m,代码为#741行。我检查了那段代码并将其包含在下面的#3中。此外,作为测试,我在调用该代码行之前放置了一个断点,并且它从未到达该代码。任何对这些问题的见解都将受到赞赏。
Incident Identifier: 1C053572-AFE5-4EB6-A95C-9E4459B860A7
CrashReporter Key: f97ebe907a31ab39c017e93a637e9e195e90d8f4
Hardware Model: iPhone5,1
Process: idcdoor [267]
Path: /private/var/mobile/Containers/Bundle/Application/8ED83A36-2A92-4601-9265- 392A9E97E89B/idcdoor.app/idcdoor
Identifier: com.zen.idcdoor
Version: 1.0 (1.0)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2014-11-01 10:26:23.652 -0500
Launch Time: 2014-11-01 10:26:20.975 -0500
OS Version: iOS 8.1 (12B411)
Report Version: 105
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x00000014
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_c.dylib 0x354877d4 strlen + 28
1 CoreFoundation 0x2771440c __CFStringAppendFormatCore + 7052
2 CoreFoundation 0x2771285c _CFStringCreateWithFormatAndArgumentsAux2 + 76
3 Foundation 0x2837f86e -[NSPlaceholderString initWithFormat:locale:arguments:] + 134
4 Foundation 0x2837f770 +[NSString stringWithFormat:] + 56
5 idcdoor 0x000a8e48 -[EngineeringViewController pickerView:numberOfRowsInComponent:] (EngineeringViewController.m:741)
6 UIKit 0x2accc60a -[UISectionRowData refreshWithSection:tableView:tableViewRowData:] + 2546
7 UIKit 0x2accbb54 -[UITableViewRowData rectForFooterInSection:heightCanBeGuessed:] + 324
8 UIKit 0x2accb994 -[UITableViewRowData heightForTable] + 52
9 UIKit 0x2accb7cc -[UITableView _updateContentSize] + 340
10 UIKit 0x2acd151e -[UITableView didMoveToWindow] + 66
11 UIKit 0x2abfbe50 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1308
12 UIKit 0x2ac1ac96 -[UIScrollView _didMoveFromWindow:toWindow:] + 46
13 UIKit 0x2abfbbc0 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 652
14 UIKit 0x2abfbbc0 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 652
15 UIKit 0x2abfb4d4 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 108
16 UIKit 0x2abfb3e8 -[UIView(Hierarchy) _postMovedFromSuperview:] + 424
17 UIKit 0x2ac0584a -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1458
18 UIKit 0x2ac0528e -[UIView(Hierarchy) addSubview:] + 26
19 UIKit 0x2ae58cb4 -[UIPickerView layoutSubviews] + 3212
20 UIKit 0x2ae5a322 -[UIPickerView selectedRowInComponent:] + 42
21 UIKit 0x2ae56bfc -[UIPickerView _updateSelectedRows] + 124
22 UIKit 0x2ae56d0a -[UIPickerView didMoveToWindow] + 94
23 UIKit 0x2abfbe50 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1308
24 UIKit 0x2abfbbc0 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 652
25 UIKit 0x2abfbbc0 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 652
26 UIKit 0x2abfbbc0 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 652
27 UIKit 0x2abfb4d4 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 108
28 UIKit 0x2abfb3e8 -[UIView(Hierarchy) _postMovedFromSuperview:] + 424
29 UIKit 0x2ac0584a -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1458
30 UIKit 0x2ac0528e -[UIView(Hierarchy) addSubview:] + 26
31 UIKit 0x2acb142a -[UINavigationTransitionView transition:fromView:toView:] + 474
32 UIKit 0x2acb1246 -[UINavigationTransitionView transition:toView:] + 22
33 UIKit 0x2aca8af2 -[UINavigationController _startTransition:fromViewController:toViewController:] + 2282
34 UIKit 0x2aca7f7e -[UINavigationController _startDeferredTransitionIfNeeded:] + 574
35 UIKit 0x2aca7ce8 -[UINavigationController __viewWillLayoutSubviews] + 40
36 UIKit 0x2aca7c7c -[UILayoutContainerView layoutSubviews] + 180
37 UIKit 0x2abfc4d2 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 510
38 QuartzCore 0x2a624a08 -[CALayer layoutSublayers] + 132
39 QuartzCore 0x2a6203e0 CA::Layer::layout_if_needed(CA::Transaction*) + 356
40 QuartzCore 0x2a620268 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 12
41 QuartzCore 0x2a61fc4c CA::Context::commit_transaction(CA::Transaction*) + 220
42 QuartzCore 0x2a61fa50 CA::Transaction::commit() + 320
43 UIKit 0x2ae601c0 -[UIApplication _reportMainSceneUpdateFinished:] + 40
44 UIKit 0x2ae60f68 -[UIApplication _runWithMainScene:transitionContext:completion:] + 2508
45 UIKit 0x2ae6b374 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke + 32
46 UIKit 0x2ae5f384 -[UIApplication workspaceDidEndTransaction:] + 128
47 FrontBoardServices 0x2decc0e6 __31-[FBSSerialQueue performAsync:]_block_invoke + 10
48 CoreFoundation 0x2770639a __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 10
49 CoreFoundation 0x2770565c __CFRunLoopDoBlocks + 212
50 CoreFoundation 0x27704196 __CFRunLoopRun + 1710
51 CoreFoundation 0x2765220c CFRunLoopRunSpecific + 472
52 CoreFoundation 0x2765201e CFRunLoopRunInMode + 102
53 UIKit 0x2ac633ea -[UIApplication _run] + 554
54 UIKit 0x2ac5e1cc UIApplicationMain + 1436
55 idcdoor 0x000af77e main (main.m:17)
56 libdyld.dylib 0x3546aaac start + 0
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x3551d2a0 kevent64 + 24
1 libdispatch.dylib 0x354569fc _dispatch_mgr_invoke + 276
2 libdispatch.dylib 0x3544c20e _dispatch_mgr_thread + 34
Thread 2:
0 libsystem_kernel.dylib 0x355319cc __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x355abea8 _pthread_wqthread + 788
2 libsystem_pthread.dylib 0x355abb80 start_wqthread + 4
Thread 3:
0 libsystem_kernel.dylib 0x355319cc __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x355abea8 _pthread_wqthread + 788
2 libsystem_pthread.dylib 0x355abb80 start_wqthread + 4
Thread 4:
0 libsystem_kernel.dylib 0x355319cc __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x355abea8 _pthread_wqthread + 788
2 libsystem_pthread.dylib 0x355abb80 start_wqthread + 4
Thread 0 crashed with ARM Thread State (32-bit):
r0: 0x00000014 r1: 0x00000014 r2: 0x00000000 r3: 0x01010101
r4: 0x00000000 r5: 0x277ab8d9 r6: 0x001ca2f8 r7: 0x001ca2f0
r8: 0x001ca884 r9: 0x00000001 r10: 0x001ca434 r11: 0x277ab8d9
ip: 0x00000018 sp: 0x001ca2f0 lr: 0x27714411 pc: 0x354877d4
cpsr: 0x60000010
Binary Images:
0x9e000 - 0xbdfff idcdoor armv7 <3a3e81a535e33b749617ea74b35051a4> /var/mobile/Containers/Bundle/Application/8ED83A36-2A92-4601-9265-392A9E97E89B/idcdoor.app/idcdoor
0x264f000 - 0x265afff GAXClient armv7s <2a03ff3e6ca83b138ffe5e1436d3a686> /System/Library/AccessibilityBundles/GAXClient.bundle/GAXClient
0x1fee5000 - 0x1ff08fff dyld armv7s <b01d37db5b0d3a2ea1ccf17afc40a896> /usr/lib/dyld
0x25d80000 - 0x25d88fff AccessibilitySettingsLoader armv7s <46e9b9bae13d3590971aca226c70bb90> /System/Library/AccessibilityBundles/AccessibilitySettingsLoader.bundle/AccessibilitySettingsLoader
0x25f48000 - 0x25f63fff libJapaneseConverter.dylib armv7s <708b951369ca3c6ca3c04cff645cb4af> /System/Library/CoreServices/Encodings/libJapaneseConverter.dylib
0x25f64000 - 0x25f85fff libKoreanConverter.dylib armv7s <12d4496cb7e234ef9248a8133281466f> /System/Library/CoreServices/Encodings/libKoreanConverter.dylib
0x25f8d000 - 0x25f9bfff libSimplifiedChineseConverter.dylib armv7s <710dea62fe2532bd833dc37458e8df31> /System/Library/CoreServices/Encodings/libSimplifiedChineseConverter.dylib
0x25f9e000 - 0x25fb0fff libTraditionalChineseConverter.dylib armv7s <b671c9d6a27e3125ab87d2b889e52885> /System/Library/CoreServices/Encodings/libTraditionalChineseConverter.dylib
0x261d6000 - 0x26342fff AVFoundation armv7s <20cb3fb302c83ede8cc708d8dea2b480> /System/Library/Frameworks/AVFoundation.framework/AVFoundation
0x26343000 - 0x263a1fff libAVFAudio.dylib armv7s <07753e16a2e136e2bbe7937c1d2833f6> /System/Library/Frameworks/AVFoundation.framework/libAVFAudio.dylib
0x263db000 - 0x263dbfff Accelerate armv7s <3c10ee15d8363fa58b719f2abca91b06> /System/Library/Frameworks/Accelerate.framework/Accelerate
0x263ec000 - 0x26607fff vImage armv7s <3358de09601333a2881365e5c74c681e> /System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/vImage
0x26608000 - 0x266eefff libBLAS.dylib armv7s <b46b7fd3985f371ca26b10f268965e63> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libBLAS.dylib
0x266ef000 - 0x269b3fff libLAPACK.dylib armv7s <eb228c255d9e349391cd6b227a9d2744> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libLAPACK.dylib
0x269b4000 - 0x269c5fff libLinearAlgebra.dylib armv7s <d2e989bc1bad320b918c37d3642db4b6> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libLinearAlgebra.dylib
0x269c6000 - 0x26a42fff libvDSP.dylib armv7s <07cf0625bd813336920eb5b62f99be06> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libvDSP.dylib
0x26a43000 - 0x26a55fff libvMisc.dylib armv7s <07997e6e46fa35a18c6ddacf62f326d8> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libvMisc.dylib
0x26a56000 - 0x26a56fff vecLib armv7s <108b763f155130828fa123813e3ff5f5> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/vecLib
0x26a57000 - 0x26a7dfff Accounts armv7s <7540bbbab44638cbbfc6f8e660b882e5> /System/Library/Frameworks/Accounts.framework/Accounts
0x26a7f000 - 0x26aeffff AddressBook armv7s <f14b87a5995235f7b4758b9177eacfff> /System/Library/Frameworks/AddressBook.framework/AddressBook
0x26af0000 - 0x26c14fff AddressBookUI armv7s <4cbc3a35503334398504bec12f184406> /System/Library/Frameworks/AddressBookUI.framework/AddressBookUI
0x26dad000 - 0x27020fff AudioToolbox armv7s <6af7bb73fc8a3820aaeddf4be11d76d1> /System/Library/Frameworks/AudioToolbox.framework/AudioToolbox
0x2718b000 - 0x27313fff CFNetwork armv7s <447c648544f63bad945945978a4420cc> /System/Library/Frameworks/CFNetwork.framework/CFNetwork
0x27314000 - 0x27395fff CloudKit armv7s <a36362766d2d34a89f0375dc3af0b266> /System/Library/Frameworks/CloudKit.framework/CloudKit
0x27396000 - 0x273f5fff CoreAudio armv7s <fc17e188a69f32b8b7a5eb739e71628a> /System/Library/Frameworks/CoreAudio.framework/CoreAudio
0x27410000 - 0x2742dfff CoreBluetooth armv7s <7013619ef098351e9327893736f9ac75> /System/Library/Frameworks/CoreBluetooth.framework/CoreBluetooth
0x2742e000 - 0x27639fff CoreData armv7s <c9df4ab3eb933030a3cec50334b917ce> /System/Library/Frameworks/CoreData.framework/CoreData
0x2763a000 - 0x27966fff CoreFoundation armv7s <88f8b217c0ee3ea99fc535279a274e51> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x27967000 - 0x27a91fff CoreGraphics armv7s <89608951c9173d66ba6318cfe83636cd> /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics
0x27ad1000 - 0x27ad3fff libCGXType.A.dylib armv7s <e655cd9db7ee35779038050110716bdf> /System/Library/Frameworks/CoreGraphics.framework/Resources/libCGXType.A.dylib
0x27ad4000 - 0x27adefff libCMSBuiltin.A.dylib armv7s <edc7a2d9b3ec34599184c14a1558e306> /System/Library/Frameworks/CoreGraphics.framework/Resources/libCMSBuiltin.A.dylib
0x27cc6000 - 0x27ce1fff libRIP.A.dylib armv7s <7245d28cd0683999ba311e1f9c44eaf0> /System/Library/Frameworks/CoreGraphics.framework/Resources/libRIP.A.dylib
0x27ce2000 - 0x27df0fff CoreImage armv7s <5c9817ffa8c939878f34e92794fe01d0> /System/Library/Frameworks/CoreImage.framework/CoreImage
0x27df1000 - 0x27e48fff CoreLocation armv7s <a25b4e5cd9db3552b17f6f933c268b4e> /System/Library/Frameworks/CoreLocation.framework/CoreLocation
0x27e7a000 - 0x27f14fff CoreMedia armv7s <c0207b0eb8a6372c82765e3f9aaae9c2> /System/Library/Frameworks/CoreMedia.framework/CoreMedia
0x27f15000 - 0x27fd4fff CoreMotion armv7s <eaf2bec24a9a339b8a72e66a50f84195> /System/Library/Frameworks/CoreMotion.framework/CoreMotion
0x27fd5000 - 0x28033fff CoreTelephony armv7s <d387fea5262f3a1a9b915eda86a9c521> /System/Library/Frameworks/CoreTelephony.framework/CoreTelephony
0x28034000 - 0x280fbfff CoreText armv7s <27a6c9f02e0c3fcdb25aa629dbac8420> /System/Library/Frameworks/CoreText.framework/CoreText
0x280fc000 - 0x28111fff CoreVideo armv7s <710cbdb8798d3e7e862a5c77ebb278b4> /System/Library/Frameworks/CoreVideo.framework/CoreVideo
0x28112000 - 0x28207fff EventKit armv7s <f5e8d9857bca3d30a82884f74acccdd9> /System/Library/Frameworks/EventKit.framework/EventKit
0x2837e000 - 0x28580fff Foundation armv7s <dae281def68e3062826ad439cc878f35> /System/Library/Frameworks/Foundation.framework/Foundation
0x285ad000 - 0x285ccfff GSS armv7s <3d6d5fcf16673331b532dc80bc9cb004> /System/Library/Frameworks/GSS.framework/GSS
0x28660000 - 0x286b6fff IOKit armv7s <694427785d6b3b158555dbb2de06ba5d> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
0x286b7000 - 0x288f9fff ImageIO armv7s <7805efbe771f3abe8eb78f8a11e43510> /System/Library/Frameworks/ImageIO.framework/ImageIO
0x288fa000 - 0x28c48fff JavaScriptCore armv7s <8efe7fde7fc334d3b4e7154fd1ad7934> /System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore
0x28f25000 - 0x28f2dfff MediaAccessibility armv7s <39f640b059a43b609c3f03d2c53ccca3> /System/Library/Frameworks/MediaAccessibility.framework/MediaAccessibility
0x28f2e000 - 0x29107fff MediaPlayer armv7s <c97f5d8967cd331687edef49d2e330ea> /System/Library/Frameworks/MediaPlayer.framework/MediaPlayer
0x29108000 - 0x29481fff MediaToolbox armv7s <61a8287d7db23902ace54438be5d01dd> /System/Library/Frameworks/MediaToolbox.framework/MediaToolbox
0x29482000 - 0x29540fff MessageUI armv7s <4d650e3067b53974b00534275f6f4e90> /System/Library/Frameworks/MessageUI.framework/MessageUI
0x29541000 - 0x295adfff Metal armv7s <55c278f571e43337a9f50f33fd7a0e19> /System/Library/Frameworks/Metal.framework/Metal
0x295ae000 - 0x2963efff MobileCoreServices armv7s <d309a94eb41f3828888fea191d26c2b4> /System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices
0x2a11a000 - 0x2a122fff OpenGLES armv7s <da72e0ef6bad373e9f10a34e7e8e69c4> /System/Library/Frameworks/OpenGLES.framework/OpenGLES
0x2a124000 - 0x2a124fff libCVMSPluginSupport.dylib armv7s <19d9172837f5361d938ae1757caf9c37> /System/Library/Frameworks/OpenGLES.framework/libCVMSPluginSupport.dylib
0x2a125000 - 0x2a127fff libCoreFSCache.dylib armv7s <ecc01c4cd2aa3cfabe2cb655e944d675> /System/Library/Frameworks/OpenGLES.framework/libCoreFSCache.dylib
0x2a128000 - 0x2a12bfff libCoreVMClient.dylib armv7s <f9bbda54797d3b119f02b904b5b616b8> /System/Library/Frameworks/OpenGLES.framework/libCoreVMClient.dylib
0x2a12c000 - 0x2a134fff libGFXShared.dylib armv7s <a4f8148c427c3a1da2d6e4f7d8f44db0> /System/Library/Frameworks/OpenGLES.framework/libGFXShared.dylib
0x2a135000 - 0x2a177fff libGLImage.dylib armv7s <25bf18582842387aadbef55023603f1b> /System/Library/Frameworks/OpenGLES.framework/libGLImage.dylib
0x2a618000 - 0x2a76afff QuartzCore armv7s <f279312e24013b3facfd0701a8f856f2> /System/Library/Frameworks/QuartzCore.framework/QuartzCore
0x2a76b000 - 0x2a7befff QuickLook armv7s <4faa07b11c763d2e8535a9eeae067d73> /System/Library/Frameworks/QuickLook.framework/QuickLook
0x2a9ad000 - 0x2a9edfff Security armv7s <de3cef25d1443557af5def374133b390> /System/Library/Frameworks/Security.framework/Security
0x2ab91000 - 0x2abedfff SystemConfiguration armv7s <f0007f16cef530dcb1681ab29db8e311> /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration
0x2abf0000 - 0x2b491fff UIKit armv7s <30f3605a26bc3155a5dbffdf1f30d2ab> /System/Library/Frameworks/UIKit.framework/UIKit
0x2b492000 - 0x2b4f9fff VideoToolbox armv7s <2a114ceb99013b3bb24c7d5544f0a575> /System/Library/Frameworks/VideoToolbox.framework/VideoToolbox
0x2b4fa000 - 0x2b6dffff WebKit armv7s <adbe79a7e1fe3e4a96388bbead166d3f> /System/Library/Frameworks/WebKit.framework/WebKit
0x2ba00000 - 0x2ba0bfff AOSNotification armv7s <9692b7bd225438e7b7832f56454a2857> /System/Library/PrivateFrameworks/AOSNotification.framework/AOSNotification
0x2bacf000 - 0x2bad6fff AccessibilityUI armv7s <5b632cc5cff034f9a3e1e533421dc2f1> /System/Library/PrivateFrameworks/Accessibility.framework/Frameworks/AccessibilityUI.framework/AccessibilityUI
0x2baee000 - 0x2baf1fff AccessibilityUIUtilities armv7s <e7c5cd1c1c223fad9e1b1d9471c1044a> /System/Library/PrivateFrameworks/Accessibility.framework/Frameworks/AccessibilityUIUtilities.framework/AccessibilityUIUtilities
0x2baf4000 - 0x2baf7fff ZoomServices armv7s <734b9fb4cf9b30f79573a25e471d55dd> /System/Library/PrivateFrameworks/Accessibility.framework/Frameworks/ZoomServices.framework/ZoomServices
....
3)这是来自EngineeringViewController.m的代码
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
if([pickerView isEqual: _pickerPreferredId]){
return sizeof(Preffered_ID);
}else if([pickerView isEqual: _pickerDrum]){
int drumCount = 0;
if(doorLiftSelection == 0){
for (int i = 0; i < sizeof Select_Drum[10]; i++){
//line 741
if([[NSString stringWithFormat: @"%s",Select_Drum[i][10]] isEqualToString:@"Standard"]){
drumCount++;
}
}
}
答案 0 :(得分:1)
在崩溃时,Select_Drum [i] [10]不是有效的C字符串。
CF正在尝试从中创建CFString / NSString,并且在尝试对字符串执行strlen()时会崩溃,以确定需要为生成的CFString分配多少内存。
至于为什么它不是有效的C字符串,您需要使用调试器来查看它,但这行看起来非常疑:
for (int i = 0; i < sizeof Select_Drum[10]; i++)
我认为这不符合你的想法。