问题
I have a Slide out navigation panel (menu) and an another "menu" on my first page.
Slide out Menu:
- Index
- Page 1
- Page 2
- Page 3
- Page 4
On Index:
- Page 1
- Page 2
- Page 3
- Page 4
So the user have access to the pages from the Index or by Sliding (or tap on Icon Menu) to have the menu.
But I have an error: I go to page 1 from the Index, I tap on the Icon Menu to slide out the Menu I tap on index, I go to page 1 again from the Index, and here if I tap again on the Icon Menu, I get error: SIGBRT (something like that)
I did some breakpoints:
On this line: self.delegate?.pushViewControllerInStack!(UIStoryboard.nosOffresViewController()!)
And one in the function pushViewControllerInStack
And when I do maniplations, my app read this line self.delegate?.pushViewControllerInStack!(UIStoryboard.nosOffresViewController()!)
but it don't go in the function.
So my view lost the access
of the function, but I don't know why and how to fix the issue.
There's a lot of code, you can find a git repository here: https://github.com/Vkt0r/SlideOutSideBarTest
the error:
2015-10-28 09:00:33.038 Solutis[477:5075] -[Solutis.NosOffresViewController menuNosOffresTapped:]: unrecognized selector sent to instance 0x7ff5caf464e0
2015-10-28 09:00:33.045 Solutis[477:5075] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Solutis.NosOffresViewController menuNosOffresTapped:]: unrecognized selector sent to instance 0x7ff5caf464e0'
*** First throw call stack:
(
0 CoreFoundation 0x000000010f3b1f65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000111268deb objc_exception_throw + 48
2 CoreFoundation 0x000000010f3ba58d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010f307f7a ___forwarding___ + 970
4 CoreFoundation 0x000000010f307b28 _CF_forwarding_prep_0 + 120
5 UIKit 0x000000010fdf31fa -[UIApplication sendAction:to:from:forEvent:] + 92
6 UIKit 0x00000001101d5247 -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 152
7 UIKit 0x000000010fdf31fa -[UIApplication sendAction:to:from:forEvent:] + 92
8 UIKit 0x000000010ff57504 -[UIControl sendAction:to:forEvent:] + 67
9 UIKit 0x000000010ff577d0 -[UIControl _sendActionsForEvents:withEvent:] + 311
10 UIKit 0x000000010ff5794b -[UIControl _sendActionsForEvents:withEvent:] + 690
11 UIKit 0x000000010ff56906 -[UIControl touchesEnded:withEvent:] + 601
12 UIKit 0x000000010fe5daa3 -[UIWindow _sendTouchesForEvent:] + 835
13 UIKit 0x000000010fe5e691 -[UIWindow sendEvent:] + 865
14 UIKit 0x000000010fe10752 -[UIApplication sendEvent:] + 263
15 UIKit 0x000000010fdebfcc _UIApplicationHandleEventQueue + 6693
16 CoreFoundation 0x000000010f2de0a1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
17 CoreFoundation 0x000000010f2d3fcc __CFRunLoopDoSources0 + 556
18 CoreFoundation 0x000000010f2d3483 __CFRunLoopRun + 867
19 CoreFoundation 0x000000010f2d2e98 CFRunLoopRunSpecific + 488
20 GraphicsServices 0x000000011485bad2 GSEventRunModal + 161
21 UIKit 0x000000010fdf1676 UIApplicationMain + 171
22 Solutis 0x000000010f1b892d main + 109
23 libdyld.dylib 0x0000000111d8092d start + 1
24 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
回答1:
You linked the action with the bar item
And you commented it:
So it would crash when you try to open the menu at that page.
来源:https://stackoverflow.com/questions/33371860/call-a-function-of-an-another-class-protocol