Ios7 错误:从不同方法执行选择器时EXC_错误访问

Ios7 错误:从不同方法执行选择器时EXC_错误访问,ios7,uigesturerecognizer,performselector,Ios7,Uigesturerecognizer,Performselector,我的“updateNotes”方法在从“TextViewDiEndEditing”调用时有效,但在“HandlerRightSwipe”(UISwipegestureRecognitor)中不起作用 我使用两种方法: [self performSelector:selector(updateNotes:)]; 方法如下: - (void)updateNotes: (id)sender { Note *noteAtIndex = [self.notes objectAt

我的“updateNotes”方法在从“TextViewDiEndEditing”调用时有效,但在“HandlerRightSwipe”(UISwipegestureRecognitor)中不起作用

我使用两种方法:

[self performSelector:selector(updateNotes:)];
方法如下:

 - (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];
    }
有什么建议吗

按照建议添加了NSLog:

- (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) 
2014-03-03 07:44:07.272检测到90天跟踪[8194:70b]左扫
2014-03-03 07:44:07.273 90天赛道[8194:70b]倒计时为1
2014-03-03 07:44:09.760 90天音轨[8194:70b]notes阵列正在运行(
“(实体:注;id:0x8e57bc0;数据:)”,
“(实体:注释;id:0x8e57bd0;数据:)”,
“(实体:注;id:0x8e57be0;数据:)”,
“(实体:注;id:0x8e57bf0;数据:)”,
“(实体:注;id:0x8e57c00;数据:)”,
“(实体:注;id:0x8e57c10;数据:)”,
“(实体:注;id:0x8e57c20;数据:)”,
“(实体:注;id:0x8e57c30;数据:)”,
“(实体:注;id:0x8e57c40;数据:)”,
“(实体:注;id:0x8e57c50;数据:)”,
“(实体:注;id:0x8e57c60;数据:)”,
“(实体:注;id:0x8e57c70;数据:)”,
“(实体:注;id:0x8e57c80;数据:)”,
“(实体:注;id:0x8e57c90;数据:)”,
“(实体:注;id:0x8e57ca0;数据:)”,
“(实体:注;id:0x8e57cb0;数据:)”,
“(实体:注;id:0x8e57cc0;数据:)”,
“(实体:注;id:0x8e57cd0;数据:)”,
“(实体:注;id:0x8e57ce0;数据:)”,
“(实体:注;id:0x8e57cf0;数据:)”,
“(实体:注释;id:0x8e57d00;数据:)”,
“(实体:注释;id:0x8e57d10;数据:)”
)
2014-03-03 07:44:12.434 90天轨道[8194:70b]新注释为(实体:注释;id:0x8b8a4f0;数据:{
天=零;
dayNote=注释;
})
2014-03-03 07:44:12.435 90天跟踪[8194:70b]新的一天是(实体:天;id:0x8b8e7f0;数据:{
日数=1;
注=无;
})
2014-03-03 07:44:15.860检测到90天跟踪[8194:70b]右扫
2014-03-03 07:44:15.861 90天赛道[8194:70b]倒数是2
(lldb)

性能选择器:
仅适用于无参数的方法
performSelector:withObject:
使用一个参数的方法,这就是您所拥有的(
updateNotes:


(还有,为什么您要使用带有固定选择器的
performSelector…
?为什么不直接调用?

NSZombies?某些内容似乎为空(已发布)。是否显示堆栈跟踪?在方法NSLog
self
中的任何其他代码之前,然后是另一个NSLog
self.notes
以查看其中一个是否可访问。添加了NSLog和堆栈跟踪。我实际上指的是崩溃时的堆栈跟踪。:)然而,从您发布的日志来看,您的方法看起来根本没有被调用……这与提供“坏访问”相反。我假设
选择器(updateNotes:)
是一个打字错误,实际上是
@selector(updateNotes:)
,对吗?是的,“选择器”是一个打字错误。我有“@”。我在这方面是新手,你可以说我肯定,所以我不知道如何获取堆栈跟踪。当我再次运行它时,它在“updateNodes”方法和“@selector”调用的线程1上显示“EXC_BAD_ACCESS(code=1,address=0xf3c0570d)”。