Question

My "updateNotes" method works when called from "textViewDidEndEditing", but does not work from "handleRightSwipe" (UISwipeGestureRecognizer).

I use in both methods:

[self performSelector:selector(updateNotes:)];

Here's the method:

 - (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];
    }

Any suggestions?

Added the NSLog as suggested:

- (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];
}

Here's the log:

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) 

No correct solution

OTHER TIPS

performSelector: only works with a method of no arguments. performSelector:withObject: works with a method of one argument, which is what you have (updateNotes:).

(Also, why are you using performSelector... with a fixed selector anyway? Why not just make the call directly?)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top