当前位置:  开发笔记 > 编程语言 > 正文

NSMutableArray崩溃应用程序

如何解决《NSMutableArray崩溃应用程序》经验,为你挑选了1个好方法。

我有一个自定义类"人".

已创建多个Person对象并将其添加到名为"personArray"的NSMutableArray中.

然后我将其中一个传递给下一个视图,称为userView.

这些都已分配和初始化.

我使用的代码是:

[userView setPerson:[personArray objectAtIndex:indexPath.row]];

单击表格行时应用程序崩溃,在调试器中显示:

Loading program into debugger…
GNU gdb 6.3.50-20050815 (Apple version gdb-960) (Sun May 18 18:38:33 UTC 2008)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin".warning: Unable to read symbols for "/System/Library/Frameworks/UIKit.framework/UIKit" (file not found).
warning: Unable to read symbols from "UIKit" (not yet mapped into memory).
warning: Unable to read symbols for "/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics" (file not found).
warning: Unable to read symbols from "CoreGraphics" (not yet mapped into memory).
Program loaded.
sharedlibrary apply-load-rules all
Attaching to program: `/Users/rich/Library/Application Support/iPhone Simulator/User/Applications/C587B508-F75C-4D8A-9C17-86BF49C99B22/Twitter.app/Twitter', process 3792.

任何有关这方面的帮助将不胜感激!

富:)

编辑

我从Unexpected Quit报告问题框中得到了这个:

Process:         Twitter [4355]
Path:            /Users/rich/Library/Application Support/iPhone Simulator/User/Applications/74BFCE7A-84FF-4D5D-80B7-1620F0D28A20/Twitter.app/Twitter
Identifier:      Twitter
Version:         ??? (???)
Code Type:       X86 (Native)
Parent Process:  launchd [83]

Interval Since Last Report:          22503 sec
Crashes Since Last Report:           3
Per-App Interval Since Last Report:  0 sec
Per-App Crashes Since Last Report:   2

Date/Time:       2009-06-12 18:16:52.121 +0100
OS Version:      Mac OS X 10.5.7 (9J61)
Report Version:  6
Anonymous UUID:  1C202A26-2A1A-4A4B-AAFA-59116B0EC46E

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000020
Crashed Thread:  0

Application Specific Information:
iPhone Simulator 1.0 (70), iPhone OS 2.0 (5A345)

Thread 0 Crashed:
0   libobjc.A.dylib                 0x9344c688 objc_msgSend + 24
1   Twitter                         0x00006843 -[UserViewController setPerson:] + 55 (UserViewController.m:56)
2   Twitter                         0x000030bb -[RootViewController tableView:didSelectRowAtIndexPath:] + 261 (RootViewController.m:85)
3   UIKit                           0x30a9cd92 -[UITableView(_UITableViewPrivate) _sendSelectionDidChange] + 97
4   UIKit                           0x30aa3eb1 -[UITableView touchesEnded:withEvent:] + 411
5   UIKit                           0x30a75c0b -[UIWindow sendEvent:] + 454
6   UIKit                           0x30a65e07 -[UIApplication sendEvent:] + 269
7   UIKit                           0x30a6522a _UIApplicationHandleEvent + 4407
8   GraphicsServices                0x31699522 SendEvent + 35
9   GraphicsServices                0x3169b88c PurpleEventTimerCallBack + 276
10  com.apple.CoreFoundation        0x90680595 CFRunLoopRunSpecific + 3141
11  com.apple.CoreFoundation        0x90680c78 CFRunLoopRunInMode + 88
12  GraphicsServices                0x31699d38 GSEventRunModal + 217
13  GraphicsServices                0x31699dfd GSEventRun + 115
14  UIKit                           0x30a5dadb -[UIApplication _run] + 440
15  UIKit                           0x30a68ce4 UIApplicationMain + 1258
16  Twitter                         0x000028e4 main + 102 (main.m:14)
17  Twitter                         0x00002852 start + 54

Thread 1:
0   libSystem.B.dylib               0x91d13286 mach_msg_trap + 10
1   libSystem.B.dylib               0x91d1aa7c mach_msg + 72
2   com.apple.CoreFoundation        0x9068004e CFRunLoopRunSpecific + 1790
3   com.apple.CoreFoundation        0x90680c78 CFRunLoopRunInMode + 88
4   WebCore                         0x32a8a450 RunWebThread + 384
5   libSystem.B.dylib               0x91d44155 _pthread_start + 321
6   libSystem.B.dylib               0x91d44012 thread_start + 34

Thread 2:
0   libSystem.B.dylib               0x91d13286 mach_msg_trap + 10
1   libSystem.B.dylib               0x91d1aa7c mach_msg + 72
2   GraphicsServices                0x3169ce0a EventReceiveThread + 467
3   libSystem.B.dylib               0x91d44155 _pthread_start + 321
4   libSystem.B.dylib               0x91d44012 thread_start + 34

Thread 3:
0   libSystem.B.dylib               0x91d13286 mach_msg_trap + 10
1   libSystem.B.dylib               0x91d1aa7c mach_msg + 72
2   com.apple.CoreFoundation        0x9068004e CFRunLoopRunSpecific + 1790
3   com.apple.CoreFoundation        0x90680c78 CFRunLoopRunInMode + 88
4   com.apple.Foundation            0x92f78530 +[NSURLConnection(NSURLConnectionReallyInternal) _resourceLoadLoop:] + 320
5   com.apple.Foundation            0x92f14e0d -[NSThread main] + 45
6   com.apple.Foundation            0x92f149b4 __NSThread__main__ + 308
7   libSystem.B.dylib               0x91d44155 _pthread_start + 321
8   libSystem.B.dylib               0x91d44012 thread_start + 34

Thread 4:
0   libSystem.B.dylib               0x91d13286 mach_msg_trap + 10
1   libSystem.B.dylib               0x91d1aa7c mach_msg + 72
2   com.apple.CoreFoundation        0x9068004e CFRunLoopRunSpecific + 1790
3   com.apple.CoreFoundation        0x90680c78 CFRunLoopRunInMode + 88
4   com.apple.CFNetwork             0x907c2298 CFURLCacheWorkerThread(void*) + 388
5   libSystem.B.dylib               0x91d44155 _pthread_start + 321
6   libSystem.B.dylib               0x91d44012 thread_start + 34

Thread 5:
0   libSystem.B.dylib               0x91d626fa select$DARWIN_EXTSN + 10
1   libSystem.B.dylib               0x91d44155 _pthread_start + 321
2   libSystem.B.dylib               0x91d44012 thread_start + 34

Thread 0 crashed with X86 Thread State (32-bit):
  eax: 0x00494630  ebx: 0x9344cc8f  ecx: 0x934fe514  edx: 0x00000000
  edi: 0x004a8420  esi: 0x00000040  ebp: 0xbfffe0b8  esp: 0xbfffe078
   ss: 0x0000001f  efl: 0x00010206  eip: 0x9344c688   cs: 0x00000017
   ds: 0x0000001f   es: 0x0000001f   fs: 0x00000000   gs: 0x00000037
  cr2: 0x00000020

Binary Images:
    0x1000 -     0x7fff +Twitter ??? (???) <0f292e372486bfc6311c226b48178dc2> /Users/rich/Library/Application Support/iPhone Simulator/User/Applications/74BFCE7A-84FF-4D5D-80B7-1620F0D28A20/Twitter.app/Twitter
   0x10000 -    0x11fff +liboainject.dylib ??? (???) <0d83c3f81b6733d13a50867064b845dd> /Developer/Applications/Instruments.app/Contents/PlugIns/MemoryPlugin.bundle/Contents/Resources/liboainject.dylib
   0x16000 -    0x16fff +libsimshim.dylib ??? (???)  /Developer/Library/PrivateFrameworks/InstrumentsPlugIn.framework/Resources/libsimshim.dylib
   0x1b000 -    0x1ffff +libGIF.dylib ??? (???)  /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/PrivateFrameworks/ImageIO.framework/libGIF.dylib
   0x25000 -    0x25fff +DataMigration ??? (???) <8190b94df60a16625c1d0a711dfce810> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/PrivateFrameworks/DataMigration.framework/DataMigration
   0x46000 -    0x72fff  com.apple.SystemConfiguration 1.9.5 (1.9.5) <8916c48065cc8a7274fe7c98a8bc755c> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration
   0x8c000 -   0x1a1fe3 +AudioToolbox ??? (???) <47bc2da19d097da44ce3a3212ca41f27> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/AudioToolbox.framework/AudioToolbox
  0x200000 -   0x221fea +libJPEG.dylib ??? (???)  /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/PrivateFrameworks/ImageIO.framework/libJPEG.dylib
  0x22a000 -   0x245fe7 +libPng.dylib ??? (???)  /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/PrivateFrameworks/ImageIO.framework/libPng.dylib
  0x24d000 -   0x251ffc +libGFXShared.dylib ??? (???) <757e5613a4dccfe0045b13e5f7108f9f> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/OpenGLES.framework/libGFXShared.dylib
  0x257000 -   0x296ffe +libGLImage.dylib ??? (???) <6df300f534f23e8aeef39d5f2f730028> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/OpenGLES.framework/libGLImage.dylib
  0x300000 -   0x30aff3 +CoreVideo ??? (???) <23a4f9dc9242912b2d0a7ff893a556b7> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/PrivateFrameworks/CoreVideo.framework/CoreVideo
  0x313000 -   0x38ffeb  com.apple.audio.CoreAudio 3.1.1 (3.1.1) <41cb72c5651cf533122fb65c464b3be2> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/CoreAudio.framework/Versions/A/CoreAudio
  0x500000 -   0x543fe6 +libCGFreetype.A.dylib ??? (???) <5d1bec00b54062913bada794887f894a> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Resources/libCGFreetype.A.dylib
  0x572000 -   0x599fe7 +libRIP.A.dylib ??? (???) <595f583c272aa909e840f93e644b5af8> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Resources/libRIP.A.dylib
  0x856000 -   0xe74fc2 +libGLProgrammability.dylib ??? (???) <1fca696da40a8fe2017deb05b0ca9f60> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/OpenGLES.framework/libGLProgrammability.dylib
0x30894000 - 0x308a0fff +AppSupport ??? (???) <7136ddcdd71ba8ac87a956711a7d3052> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/PrivateFrameworks/AppSupport.framework/AppSupport
0x30a54000 - 0x30c9dfe4 +UIKit ??? (???)  /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/UIKit.framework/UIKit
0x30fce000 - 0x311d3fff  com.apple.CoreGraphics 1.359.4 (???)  /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics
0x3124f000 - 0x3125dfff +OpenGLES ??? (???)  /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/OpenGLES.framework/OpenGLES
0x31290000 - 0x31350ff3 +JavaScriptCore ??? (???)  /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore
0x31696000 - 0x3169eff1 +GraphicsServices ??? (???) <068d0945d990a619e47e5915c318903e> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
0x31707000 - 0x31747fe7 +ImageIO ??? (???)  /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/PrivateFrameworks/ImageIO.framework/ImageIO
0x3179c000 - 0x317dafef +libTIFF.dylib ??? (???) <9cb64be0480b2a32a9e5f5eb3f0cfda0> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/PrivateFrameworks/ImageIO.framework/libTIFF.dylib
0x318da000 - 0x318dcfff +IAP ??? (???) <6d754b165e29ec239f421fc9871720e3> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/PrivateFrameworks/IAP.framework/IAP
0x31b9a000 - 0x31bb2fff +AddressBook ??? (???)  /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/AddressBook.framework/AddressBook
0x31e7f000 - 0x31ef3fe7 +QuartzCore ??? (???) <6c4bfbe306a67a09ba333ae2041aa543> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/QuartzCore.framework/QuartzCore
0x326a4000 - 0x32b13fff +WebCore ??? (???) <6d001f5b0ea23a29efa0a52413954387> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/PrivateFrameworks/WebCore.framework/WebCore
0x32dd5000 - 0x32e44ff1 +WebKit ??? (???)  /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/PrivateFrameworks/WebKit.framework/WebKit
0x33b25000 - 0x33b2cffd +SpringBoardServices ??? (???)  /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices
0x8fe00000 - 0x8fe2db43  dyld 97.1 (???) <100d362e03410f181a34e04e94189ae5> /usr/lib/dyld
0x90003000 - 0x90027fff  libxslt.1.dylib ??? (???) <0a9778d6368ae668826f446878deb99b> /usr/lib/libxslt.1.dylib
0x9060d000 - 0x90740fef  com.apple.CoreFoundation 6.5.6 (476.18) <2d52bab73660117571bd6486dc318f8e> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
0x907bf000 - 0x90863fec  com.apple.CFNetwork 438.10 (438.12)  /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CFNetwork.framework/Versions/A/CFNetwork
0x908f9000 - 0x909daff7  libxml2.2.dylib ??? (???) <068cab13eb4608a7c6a5fad807ee0e33> /usr/lib/libxml2.2.dylib
0x90a20000 - 0x90aa7ff7  libsqlite3.0.dylib ??? (???) <3334ea5af7a911637413334154bb4100> /usr/lib/libsqlite3.0.dylib
0x91d12000 - 0x91e79ff3  libSystem.B.dylib ??? (???)  /usr/lib/libSystem.B.dylib
0x92194000 - 0x92194ffa  com.apple.CoreServices 32 (32) <2760719f7a81e8c2bdfd15b0939abc29> /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
0x92195000 - 0x9219cfe9  libgcc_s.1.dylib ??? (???) <28a7cbc3a5ca2982d124668306f422d9> /usr/lib/libgcc_s.1.dylib
0x92570000 - 0x92586fff  com.apple.DictionaryServices 1.0.0 (1.0.0) <7e9ff586b5c9d02b09e2a5527d98524f> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/DictionaryServices.framework/Versions/A/DictionaryServices
0x92593000 - 0x926ccff7  libicucore.A.dylib ??? (???)  /usr/lib/libicucore.A.dylib
0x92a4c000 - 0x92a6afff  libresolv.9.dylib ??? (???)  /usr/lib/libresolv.9.dylib
0x92e33000 - 0x92ebfff7  com.apple.framework.IOKit 1.5.2 (???) <97b9f9d584f48891377f0481b9104434> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
0x92f0a000 - 0x93186fe7  com.apple.Foundation 6.5.8 (677.24)  /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
0x932f4000 - 0x932fbffe  libbsm.dylib ??? (???) <5582985a86ea36504cca31788bccf963> /usr/lib/libbsm.dylib
0x93437000 - 0x93517fff  libobjc.A.dylib ??? (???) <7b92613fdf804fd9a0a3733a0674c30b> /usr/lib/libobjc.A.dylib
0x93d17000 - 0x93d74ffb  libstdc++.6.dylib ??? (???) <6106b1f2b0b303b06ae476253dbb5f3f> /usr/lib/libstdc++.6.dylib
0x941a0000 - 0x941a8fff  com.apple.DiskArbitration 2.2.1 (2.2.1) <75b0c8d8940a8a27816961dddcac8e0f> /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration
0x941ad000 - 0x94267fe3  com.apple.CoreServices.OSServices 227 (227) <30cebcb68b1b571df7d77474e0c31556> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices
0x948c0000 - 0x94909fef  com.apple.Metadata 10.5.2 (398.25)  /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata
0x951e0000 - 0x951eeffd  libz.1.dylib ??? (???) <545ca09467025f77131cfac09d8b9375> /usr/lib/libz.1.dylib
0x95f97000 - 0x96016ff5  com.apple.SearchKit 1.2.1 (1.2.1) <3140a605db2abf56b237fa156a08b28b> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SearchKit.framework/Versions/A/SearchKit
0x9601c000 - 0x96047fe7  libauto.dylib ??? (???) <42d8422dc23a18071869fdf7b5d8fab5> /usr/lib/libauto.dylib
0x96049000 - 0x9621affb  com.apple.security 5.0.5 (36371)  /System/Library/Frameworks/Security.framework/Versions/A/Security
0x96420000 - 0x964acff7  com.apple.LaunchServices 290.3 (290.6)  /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices
0x964ad000 - 0x964b1fff  libmathCommon.A.dylib ??? (???) /usr/lib/system/libmathCommon.A.dylib
0x968cc000 - 0x96ba6ff3  com.apple.CoreServices.CarbonCore 786.11 (786.13) <9e2d85d52e5e2951aa4dd53c48ccc52f> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore
0x96bc0000 - 0x96beffe3  com.apple.AE 402.3 (402.3)  /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/AE
0xfffe8000 - 0xfffebfff  libobjc.A.dylib ??? (???) /usr/lib/libobjc.A.dylib
0xffff0000 - 0xffff1780  libSystem.B.dylib ??? (???) /usr/lib/libSystem.B.dylib

这些帮助有用?

谢谢Rich



1> Tony Eichelb..:

刚出门,但你确定在创建它时添加nil作为数组中的最后一个元素吗?

NSMutableArray*array = [NSMutableArray arrayWithObjects:@"one",@"two",@"three",@"four",nil];

推荐阅读
我我檬檬我我186
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有