在我以前的帖子iPhone - update the property of nth object of a NSMutablearray我得到了在viewDidLoad中工作的東西,但是當我嘗試在 - (void)touchesMoved中使用幾乎相同的代碼:(NSSet * )觸及事件:(UIEvent *)事件,然後應用程序崩潰。iPhone - 從touchesMovedwithEvent更新NSMutablearray的第n個對象的屬性
@interface
int activeItem;
int startFrom;
NSMutableArray *iconsMutableArray;
NSMutableArray *textsMutableArray;
然後
@property int activeItem;
@property int startFrom;
- (NSMutableArray *)iconsMutableArray;
- (NSMutableArray *)textsMutableArray;
@synthesize activeItem;
@synthesize startFrom;
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
activeItem = (int)startFrom + (int)round(animationEndTo/AngleForEachItem);
[[iconsMutableArray objectAtIndex:activeItem] setImage:[UIImage imageNamed:[NSString stringWithFormat:@"Guide-Icon-%d_Active.png", activeItem]]];
}
但我的應用程序無法更新的UIImageView和崩潰而不顯示任何錯誤消息。 任何人都可以幫我嗎? 在此先感謝。
下面是崩潰報告:
異常類型:EXC_BAD_ACCESS(SIGSEGV) 異常代碼:KERN_INVALID_ADDRESS在0x0000000032200002 墜毀主題:0調度隊列:com.apple.main線程
特定應用信息: objc_msgSend()的選擇器名稱:objectAtIndex: iPhone模擬器238.2,iPhone OS 4.3(ipad公司/ 8F192) iPhone模擬器238.2,iPhone OS 4.3(ipad公司/ 8F192)
線程0崩潰:調度隊列:com.apple.main-thread 0 libobjc.A.dylib 0x0197a09f objc_msgSend + 19 1 ??? 0x00229810 OBJC_CLASS _ $ _的NSNumber + 0 2的UIKit 0x003b90f4 forwardMethod2 + 92 3的UIKit 0x003b90f4 forwardMethod2 + 92 4的UIKit 0x0030fd97 - [一個UIWindow _sendTouchesForEvent:] + 481 5的UIKit 0x002f0c37 - [UIApplication的的SendEvent:] + 447 6的UIKit 0x002f5f2e _UIApplicationHandleEvent + 7576 7個GraphicsServices 0x01e87992 PurpleEventCallback + 1550 8的CoreFoundation 0x017f5944 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 52 9的CoreFoundation 0x01755cf7 __CFRunLoopDoSource1 + 215 10的CoreFoundation 0x01752f83 __CFRunLoopRun + 979 11的CoreFoundation 0x01752840 CFRunLoopRunS pecific + 208 12的CoreFoundation 0x01752761 CFRunLoopRunInMode + 97個 13 GraphicsServices 0x01e861c4 GSEventRunModal + 217個 14 GraphicsServices 0x01e86289 GSEventRun + 115 15的UIKit 0x002f9c93 UIApplicationMain + 1160 16 MJA 0x00002bde主+ 96(的main.m:14) 17 MJA 0x00002b75開始+ 53
線程1: 0 libSystem.B.dylib 0x9119d922 KEVENT + 10 1 libdispatch_sim.dylib 0x01d92f36 _dispatch_mgr_invoke + 237 2 libdispatch_sim.dylib 0x01d93333 _dispatch_queue_invoke + 162 3 libdispatch_sim.dylib 0x01d93593 _dispatch_worker_thread 2 + 261 4 libSystem.B.dylib 0x9119cd21 _pthread_wqthread + 390 5 libSystem.B.dylib 0x9119cb66 start_wqthread + 30
線程2:WebThread 0 libSystem.B.dylib 0x9117709a mach_msg_trap + 10 1 libSystem.B。dylib 0x91177807 mach_msg + 68 2的CoreFoundation 0x017f5d86 __CFRunLoopServiceMachPort + 150 3的CoreFoundation 0x01752e74 __CFRunLoopRun + 708 4的CoreFoundation 0x01752840 CFRunLoopRunSpecific + 208 5的CoreFoundation 0x01752761 CFRunLoopRunInMode + 97 6的WebCore 0x02f13913 RunWebThread(無效*)+ 499 7 libSystem.B。 dylib 0x911a47fd _pthread_start + 345 8 libSystem.B.dylib 0x911a4682 thread_start + 34
線程3: 0 libSystem.B.dylib 0x9117709a mach_msg_trap + 10 1 libSystem.B.dylib 0x91177807 mach_msg + 68 2的CoreFoundation 0x017f5d86 CFRunLoopServiceMachPort + 150 3的CoreFoundation 0x01752e74 __CFRunLoopRun + 708 4的CoreFoundation 0x01752840 CFRunLoopRunSpecific + 208 5的CoreFoundation 0x01752761 CFRunLoopRunInMode + 97 6基金會0x0008b102 + [NSURLConnection的(NSURLConnectionReallyInternal)_resourceLoadLoop:] + 398 7基金會0x00055cf4 - [NSThread主] + 81 8基金會0x00055c80 __NSThread__main + 1387 9 libSystem.B.dylib 0x911a47fd _pthread_start + 345 10 libSystem.B.dylib 0x911a4682 thread_start + 34
線程4:com.apple.CFSocket.privat È 0 libSystem.B.dylib 0x91196066選擇$ DARWIN_EXTSN + 10 1的CoreFoundation 0x017872bc __CFSocketManager + 812 2 libSystem.B.dylib 0x911a47fd _pthread_start + 345 3 libSystem.B.dylib 0x911a4682 thread_start + 34
線程0墜毀與X86線程狀態(32位): EAX:0x05e0e840 EBX:0x05a0ef11 ECX:0x05a05484 EDX:0x05e6b200 EDI:0x32200002 ESI:0x00229810 EBP:0xbfffd728 ESP:0xbfffd6c4 SS:0x0000001f EFL:0x00010202 EIP:0x0197a09f CS:0x00000017 ds:0x0000001f es:0x0000001f fs:0x00000000 gs:0x00000037 cr2:0x32200002
顯示您的崩潰日誌.. – Jhaliya 2011-05-16 16:08:22
嗨Jhaliya, 我已經添加了崩潰報告。請檢查現在 – itsazzad 2011-05-16 16:25:32