2014-03-03 2 views
0

"updateNotes"메서드는 "textViewDidEndEditing"에서 호출 할 때 작동하지만 "handleRightSwipe"(UISwipeGestureRecognizer)에서는 작동하지 않습니다. 두 방법 모두에서오류 : 다른 메서드에서 선택기를 수행 할 때 EXC_BAD_ACCESS

내가 사용하는

:

- (void)updateNotes: (id)sender 
    { 
     Note *noteAtIndex = [self.notes objectAtIndex:countDown]; 
     NSLog(@"noteAtIndex is %@", noteAtIndex); 
     NSLog(@"noteAtIndex.dayNote is %@", noteAtIndex.dayNote); 
     //self.noteLabel.text = noteAtIndex.dayNote; 
     [self.noteTextView setText:noteAtIndex.dayNote]; 
    } 

어떤 제안 : 여기

[self performSelector:selector(updateNotes:)]; 

는 방법입니까?

- (void)updateNotes: (id)sender 
{ 
    NSLog(@"self is %@", self); 
    NSLog(@"self.notes is %@", self.notes); 
    Note *noteAtIndex = [self.notes objectAtIndex:countDown]; 
    NSLog(@"noteAtIndex is %@", noteAtIndex); 
    NSLog(@"noteAtIndex.dayNote is %@", noteAtIndex.dayNote); 
    //self.noteLabel.text = noteAtIndex.dayNote; 
    NSLog(@"Stack trace : %@",[NSThread callStackSymbols]); 
    [self.noteTextView setText:noteAtIndex.dayNote]; 
} 

여기 로그입니다 :

2014-03-03 07:44:07.272 90 Day Track[8194:70b] left swipe detected 
2014-03-03 07:44:07.273 90 Day Track[8194:70b] countDown is 1 
2014-03-03 07:44:09.760 90 Day Track[8194:70b] notes array is (
    "<Note: 0x8e58e40> (entity: Note; id: 0x8e57bc0 <x-coredata://F27E8E39-7579-4CB5-9637-683892414E95/Note/p1> ; data: <fault>)", 
    "<Note: 0x8e59080> (entity: Note; id: 0x8e57bd0 <x-coredata://F27E8E39-7579-4CB5-9637-683892414E95/Note/p2> ; data: <fault>)", 
    "<Note: 0x8e590c0> (entity: Note; id: 0x8e57be0 <x-coredata://F27E8E39-7579-4CB5-9637-683892414E95/Note/p3> ; data: <fault>)", 
    "<Note: 0x8e59100> (entity: Note; id: 0x8e57bf0 <x-coredata://F27E8E39-7579-4CB5-9637-683892414E95/Note/p4> ; data: <fault>)", 
    "<Note: 0x8e59140> (entity: Note; id: 0x8e57c00 <x-coredata://F27E8E39-7579-4CB5-9637-683892414E95/Note/p5> ; data: <fault>)", 
    "<Note: 0x8e59180> (entity: Note; id: 0x8e57c10 <x-coredata://F27E8E39-7579-4CB5-9637-683892414E95/Note/p6> ; data: <fault>)", 
    "<Note: 0x8e591c0> (entity: Note; id: 0x8e57c20 <x-coredata://F27E8E39-7579-4CB5-9637-683892414E95/Note/p7> ; data: <fault>)", 
    "<Note: 0x8e59200> (entity: Note; id: 0x8e57c30 <x-coredata://F27E8E39-7579-4CB5-9637-683892414E95/Note/p8> ; data: <fault>)", 
    "<Note: 0x8e59240> (entity: Note; id: 0x8e57c40 <x-coredata://F27E8E39-7579-4CB5-9637-683892414E95/Note/p9> ; data: <fault>)", 
    "<Note: 0x8e59280> (entity: Note; id: 0x8e57c50 <x-coredata://F27E8E39-7579-4CB5-9637-683892414E95/Note/p10> ; data: <fault>)", 
    "<Note: 0x8e592c0> (entity: Note; id: 0x8e57c60 <x-coredata://F27E8E39-7579-4CB5-9637-683892414E95/Note/p11> ; data: <fault>)", 
    "<Note: 0x8e59300> (entity: Note; id: 0x8e57c70 <x-coredata://F27E8E39-7579-4CB5-9637-683892414E95/Note/p12> ; data: <fault>)", 
    "<Note: 0x8e59340> (entity: Note; id: 0x8e57c80 <x-coredata://F27E8E39-7579-4CB5-9637-683892414E95/Note/p13> ; data: <fault>)", 
    "<Note: 0x8e59380> (entity: Note; id: 0x8e57c90 <x-coredata://F27E8E39-7579-4CB5-9637-683892414E95/Note/p14> ; data: <fault>)", 
    "<Note: 0x8e593c0> (entity: Note; id: 0x8e57ca0 <x-coredata://F27E8E39-7579-4CB5-9637-683892414E95/Note/p15> ; data: <fault>)", 
    "<Note: 0x8e59400> (entity: Note; id: 0x8e57cb0 <x-coredata://F27E8E39-7579-4CB5-9637-683892414E95/Note/p16> ; data: <fault>)", 
    "<Note: 0x8e59440> (entity: Note; id: 0x8e57cc0 <x-coredata://F27E8E39-7579-4CB5-9637-683892414E95/Note/p17> ; data: <fault>)", 
    "<Note: 0x8e59480> (entity: Note; id: 0x8e57cd0 <x-coredata://F27E8E39-7579-4CB5-9637-683892414E95/Note/p18> ; data: <fault>)", 
    "<Note: 0x8e594c0> (entity: Note; id: 0x8e57ce0 <x-coredata://F27E8E39-7579-4CB5-9637-683892414E95/Note/p19> ; data: <fault>)", 
    "<Note: 0x8e59500> (entity: Note; id: 0x8e57cf0 <x-coredata://F27E8E39-7579-4CB5-9637-683892414E95/Note/p20> ; data: <fault>)", 
    "<Note: 0x8e59540> (entity: Note; id: 0x8e57d00 <x-coredata://F27E8E39-7579-4CB5-9637-683892414E95/Note/p21> ; data: <fault>)", 
    "<Note: 0x8e59580> (entity: Note; id: 0x8e57d10 <x-coredata://F27E8E39-7579-4CB5-9637-683892414E95/Note/p22> ; data: <fault>)" 
) 
2014-03-03 07:44:12.434 90 Day Track[8194:70b] newNote is <Note: 0x8b8a4c0> (entity: Note; id: 0x8b8a4f0 <x-coredata:///Note/tFAB4D984-C9A9-4322-96F4-36AA1557F8E72> ; data: { 
    day = nil; 
    dayNote = Notes; 
}) 
2014-03-03 07:44:12.435 90 Day Track[8194:70b] newDay is <Day: 0x8b8fbe0> (entity: Day; id: 0x8b8e7f0 <x-coredata:///Day/tFAB4D984-C9A9-4322-96F4-36AA1557F8E73> ; data: { 
    dayNumber = 1; 
    note = nil; 
}) 
2014-03-03 07:44:15.860 90 Day Track[8194:70b] right swipe detected 
2014-03-03 07:44:15.861 90 Day Track[8194:70b] countDown is 2 
(lldb) 
+0

NSZombies를 (또한, 왜 당신은 왜 그냥 직접 전화를하지? 어쨌든 고정 셀렉터 performSelector...를 사용)? 뭔가가 null로 (이미 출시 된 것 같습니다). – Larme

+0

스택 추적 표시? 'updateNotes' 메소드의 다른 코드 인 NSLog'self'와 다른 하나는'self.notes'의 또 다른 NSLog가 있습니다. –

+0

NSLogs 및 스택 추적을 추가했습니다. – user2490500

답변

1

performSelector: 만 인수하는 방법으로 작동

제안으로 NSLog을 추가했습니다. performSelector:withObject:은 사용자가 가지고있는 하나의 인수 ( updateNotes:)의 메소드와 함께 작동합니다.