Error EXC_BAD_ACCESS when pressing button - ios

When i press my button, i got a error of access.
the error : Thread 1 : EXC_BAD_ACCESS(code=1,address=0xd0a937db)
TTest.h
#interface TTtest : NSObject
{
UIButton *monBouton ;
UIImage *skin;
}
- (void)initTest :(UIView*)vueDonne;
-(void)test:(id)sender;
TTest.m
- (void)initTest :(UIView*)vueDonne
{
skin = [UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource:#"boutonG" ofType:#"png"]];
monBouton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
monBouton.frame = CGRectMake(50, 50, 45, 50);
[monBouton setImage:skin forState:UIControlStateNormal];
[monBouton addTarget:self action:#selector(test:) forControlEvents:UIControlEventTouchDown];
[vueDonne addSubview: monBouton];
}
-(void)test:(id)sender //didn't work because i have the probleme
{
NSLog(#"test clicked");
}
testViewController.m
- (void)viewDidLoad
{
[super viewDidLoad];
TTtest *test =[[TTtest alloc] init];
[test initTest:_testView]; //View of my application
}
EDIT:
If i add monBouton = [[UIButton alloc] init];
I get a problem of SIGABRT
2014-10-26 16:47:22.827 testAsk[2134:a0b] -[CALayerArray test:]: unrecognized selector sent to instance 0xa141ea0
2014-10-26 16:47:22.831 testAsk[2134:a0b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CALayerArray test:]: unrecognized selector sent to instance 0xa141ea0'
*** First throw call stack:
(
0 CoreFoundation 0x017395e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x014bc8b6 objc_exception_throw + 44
2 CoreFoundation 0x017d6903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x0172990b ___forwarding___ + 1019
4 CoreFoundation 0x017294ee _CF_forwarding_prep_0 + 14
5 libobjc.A.dylib 0x014ce874 -[NSObject performSelector:withObject:withObject:] + 77
6 UIKit 0x0022c0c2 -[UIApplication sendAction:to:from:forEvent:] + 108
7 UIKit 0x0022c04e -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
8 UIKit 0x003240c1 -[UIControl sendAction:to:forEvent:] + 66
9 UIKit 0x00324484 -[UIControl _sendActionsForEvents:withEvent:] + 577
10 UIKit 0x003231fd -[UIControl touchesBegan:withEvent:] + 254
11 UIKit 0x0026934b -[UIWindow _sendTouchesForEvent:] + 386
12 UIKit 0x0026a184 -[UIWindow sendEvent:] + 1232
13 UIKit 0x0023de86 -[UIApplication sendEvent:] + 242
14 UIKit 0x0022818f _UIApplicationHandleEventQueue + 11421
15 CoreFoundation 0x016c283f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
16 CoreFoundation 0x016c21cb __CFRunLoopDoSources0 + 235
17 CoreFoundation 0x016df29e __CFRunLoopRun + 910
18 CoreFoundation 0x016deac3 CFRunLoopRunSpecific + 467
19 CoreFoundation 0x016de8db CFRunLoopRunInMode + 123
20 GraphicsServices 0x0368e9e2 GSEventRunModal + 192
21 GraphicsServices 0x0368e809 GSEventRun + 104
22 UIKit 0x0022ad3b UIApplicationMain + 1225
23 testAsk 0x000027bd main + 141
24 libdyld.dylib 0x01d75725 start + 0
25 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

The reason for the crash is that test object is dealloced when it receives the button action.
TTtest *test =[[TTtest alloc] init]; //dealloced after viewDidLoad
so try to make the test a property and use self.test.
self.test =[[TTtest alloc] init];

Doesn't look like you defined the selector "test"
-(void)test: (id) sender
NSLog(#"test clicked");
}

Related

App crashes after adding gesture UITapGestureRecognizer to UILabel

I'm fairly new to Objective C. I am trying to add a tap gesture recognizer to the UILabel. But the app crashes when trying to call the selector method. Here's what I am doing.
- (instancetype)initWithCard:(Card *)obj {
//few lines of code here...
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self.selectionHeaderLabel action:#selector(onLabelTapped:)];
_selectionHeaderLabel.userInteractionEnabled = YES;
[self.selectionHeaderLabel addGestureRecognizer:tap];
}
-(void) onLabelTapped:(UITapGestureRecognizer *) recognizer {
if ([recognizer state] == UIGestureRecognizerStateEnded) {
//do some stuff
}
}
I followed this answer, but that is not helping me.
https://stackoverflow.com/a/9058735/4863339
EDIT: Here is the crash report
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UILabel onLabelTapped:]: unrecognized selector sent to instance 0x7f8c4f5252e0'
*** First throw call stack:
(
0 CoreFoundation 0x000000011027334b exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010f7d821e objc_exception_throw + 48
2 CoreFoundation 0x00000001102e2f34 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00000001101f8c15 ___forwarding_ + 1013
4 CoreFoundation 0x00000001101f8798 _CF_forwarding_prep_0 + 120
5 UIKit 0x000000010da5f289 -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] + 57
6 UIKit 0x000000010da67028 _UIGestureRecognizerSendTargetActions + 109
7 UIKit 0x000000010da64af7 _UIGestureRecognizerSendActions + 227
8 UIKit 0x000000010da63d83 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 891
9 UIKit 0x000000010da4fe56 _UIGestureEnvironmentUpdate + 1395
10 UIKit 0x000000010da4f89b -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 521
11 UIKit 0x000000010da4ea7e -[UIGestureEnvironment _updateGesturesForEvent:window:] + 286
12 UIKit 0x000000010d58d7ad -[UIWindow sendEvent:] + 3989
13 UIKit 0x000000010d53aa33 -[UIApplication sendEvent:] + 371
14 UIKit 0x000000010dd2cb6d dispatchPreprocessedEventFromEventQueue + 3248
15 UIKit 0x000000010dd25817 __handleEventQueue + 4879
16 CoreFoundation 0x0000000110218311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
17 CoreFoundation 0x00000001101fd59c __CFRunLoopDoSources0 + 556
18 CoreFoundation 0x00000001101fca86 __CFRunLoopRun + 918
19 CoreFoundation 0x00000001101fc494 CFRunLoopRunSpecific + 420
20 GraphicsServices 0x0000000114460a6f GSEventRunModal + 161
21 UIKit 0x000000010d51cf34 UIApplicationMain + 159
22 CollPoll 0x000000010bdcf8df main + 111
23 libdyld.dylib 0x000000011267a68d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I guess you are passing the target wrong. just pass self instead of self.selectionHeaderLabel.
Then, code will be like this :
- (instancetype)initWithCard:(Card *)obj {
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:#selector(onLabelTapped:)];
_selectionHeaderLabel.userInteractionEnabled = YES;
[self.selectionHeaderLabel addGestureRecognizer:tap];
}
Hope this works for you.

Calling method is causing Error creating LLDB target

I am trying to make my first Objective-C library. I am creating a method which will take in a UIImage and return NSMutableData. I have created the following:
+ (NSMutableData *)GetDataToSendToPrinter:(UIImage *)image
{
int maxWidth = 100;
BOOL drawerKick = YES;
BOOL compressionEnable = YES;
RasterDocument *rasterDoc = [[RasterDocument alloc] initWithDefaults:RasSpeed_Medium endOfPageBehaviour:RasPageEndMode_FeedAndFullCut endOfDocumentBahaviour:RasPageEndMode_FeedAndFullCut topMargin:RasTopMargin_Standard pageLength:0 leftMargin:0 rightMargin:0];
StarBitmap *starbitmap = [[StarBitmap alloc] initWithUIImage:image :maxWidth :false];
NSMutableData *commandsToPrint = [[NSMutableData alloc] init];
NSData *shortcommand = [rasterDoc BeginDocumentCommandData];
[commandsToPrint appendData:shortcommand];
shortcommand = [starbitmap getImageDataForPrinting:compressionEnable];
[commandsToPrint appendData:shortcommand];
shortcommand = [rasterDoc EndDocumentCommandData];
[commandsToPrint appendData:shortcommand];
if (drawerKick == YES) {
[commandsToPrint appendBytes:"\x07"
length:sizeof("\x07") - 1]; // KickCashDrawer
}
[starbitmap release];
[rasterDoc release];
return commandsToPrint;
}
Just for testing purposes, I am trying to call it from a button click event:
- (IBAction)DevButton_TouchUpInside:(id)sender {
UIImage *imageToPrint = [UIImage imageNamed:#"image1.png"];
// NSMutableData *commandsToPrint = [[NSMutableData alloc] init];
// *commandsToPrint=[self GetDataToSendToPrinter:imageToPrint];
//This is where I call it
NSMutableData *commandsToPrint = [self GetDataToSendToPrinter:imageToPrint];
int commandSize = (int)[commandsToPrint length];
unsigned char *dataToSentToPrinter = (unsigned char *)malloc(commandSize);
[commandsToPrint getBytes:dataToSentToPrinter];
NSString *portName = #"TCP:10.0.1.4";
NSString *portSettings = #"Standard";
NSMutableString *message;
SMPort *starPort = nil;
starPort = [SMPort getPort:portName :portSettings :10000];
[starPort writePort:dataToSentToPrinter :0 :commandSize];
}
However I keep getting the following crash when clicking on the button:
Warning: Error creating LLDB target at path '/Users/.../Library/Developer/Xcode/DerivedData/IOS_SDK-cjctcqoxudpegpadjbwitveqtkso/Build/Products/Debug-iphonesimulator/StarIO SDK.app'- using an empty LLDB target which can cause slow memory reads from remote devices.
2014-09-26 18:39:22.588 StarIO SDK[17823:513276] -[IOS_SDKViewControllerRasterMode GetDataToSendToPrinter:]: unrecognized selector sent to instance 0xb366260
2014-09-26 18:39:22.624 StarIO SDK[17823:513276] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[IOS_SDKViewControllerRasterMode GetDataToSendToPrinter:]: unrecognized selector sent to instance 0xb366260'
*** First throw call stack:
(
0 CoreFoundation 0x021c4df6 __exceptionPreprocess + 182
1 libobjc.A.dylib 0x01c49a97 objc_exception_throw + 44
2 CoreFoundation 0x021cca75 -[NSObject(NSObject) doesNotRecognizeSelector:] + 277
3 CoreFoundation 0x021159c7 ___forwarding___ + 1047
4 CoreFoundation 0x0211558e _CF_forwarding_prep_0 + 14
5 StarIO SDK 0x000428bb -[IOS_SDKViewControllerRasterMode DevButton_TouchUpInside:] + 107
6 libobjc.A.dylib 0x01c5f7cd -[NSObject performSelector:withObject:withObject:] + 84
7 UIKit 0x0042179d -[UIApplication sendAction:to:from:forEvent:] + 99
8 UIKit 0x0042172f -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 64
9 UIKit 0x00554a16 -[UIControl sendAction:to:forEvent:] + 69
10 UIKit 0x00554e33 -[UIControl _sendActionsForEvents:withEvent:] + 598
11 UIKit 0x0055409d -[UIControl touchesEnded:withEvent:] + 660
12 UIKit 0x00471aba -[UIWindow _sendTouchesForEvent:] + 874
13 UIKit 0x00472595 -[UIWindow sendEvent:] + 791
14 UIKit 0x00437aa9 -[UIApplication sendEvent:] + 242
15 UIKit 0x004478de _UIApplicationHandleEventFromQueueEvent + 20690
16 UIKit 0x0041c079 _UIApplicationHandleEventQueue + 2206
17 CoreFoundation 0x020e87bf __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
18 CoreFoundation 0x020de2cd __CFRunLoopDoSources0 + 253
19 CoreFoundation 0x020dd828 __CFRunLoopRun + 952
20 CoreFoundation 0x020dd1ab CFRunLoopRunSpecific + 443
21 CoreFoundation 0x020dcfdb CFRunLoopRunInMode + 123
22 GraphicsServices 0x03b8c24f GSEventRunModal + 192
23 GraphicsServices 0x03b8c08c GSEventRun + 104
24 UIKit 0x0041fe16 UIApplicationMain + 1526
25 StarIO SDK 0x000027e2 main + 130
26 libdyld.dylib 0x036f0ac9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I asume I am missing something really basic. It's the first Objective-C method I have created, I'm just looking at building a simple library I can then wrap in a Xamarin binding. Where am I going wrong?
You're calling a class method from an instance method.
+ (NSMutableData *)GetDataToSendToPrinter:(UIImage *)image //Should be called using the class name
- (IBAction)DevButton_TouchUpInside:(id)sender //Should be called using self
I'm not sure how that compiled actually, you should've gotten an error like this:
No visible #interface for IOS_SDKViewControllerRasterMode declares the selector 'GetDataToSendToPrinter:'
Per the log it spit out, it's not finding the function GetDataToSendToPrinter:. Try calling it as a class method:
NSMutableData *commandsToPrint = [IOS_SDKViewControllerRasterMode GetDataToSendToPrinter:imageToPrint];

How to add UIRefreshControl

I want to add UIRefreshControl to my app which fetches the records from the database when the table is pulled down , I have done the following code but it is giving me error like
2014-08-06 12:31:56.263 QuizUsindDB[1183:60b] -[ScoreViewController readScoreFromDatabase]: unrecognized selector sent to instance 0x8d3d8e0
2014-08-06 12:31:56.266 QuizUsindDB[1183:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ScoreViewController readScoreFromDatabase]: unrecognized selector sent to instance 0x8d3d8e0'
*** First throw call stack:
(
0 CoreFoundation 0x018f81e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x016778e5 objc_exception_throw + 44
2 CoreFoundation 0x01995243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x018e850b ___forwarding___ + 1019
4 CoreFoundation 0x018e80ee _CF_forwarding_prep_0 + 14
5 libobjc.A.dylib 0x0168982b -[NSObject performSelector:withObject:] + 70
6 UIKit 0x003393b9 -[UIApplication sendAction:to:from:forEvent:] + 108
7 UIKit 0x00339345 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
8 UIKit 0x0043abd1 -[UIControl sendAction:to:forEvent:] + 66
9 UIKit 0x0043afc6 -[UIControl _sendActionsForEvents:withEvent:] + 577
10 UIKit 0x0043ac06 -[UIControl sendActionsForControlEvents:] + 48
11 UIKit 0x00a227e9 -[UIRefreshControl _setRefreshControlState:notify:] + 404
12 UIKit 0x00a22650 -[UIRefreshControl setRefreshControlState:] + 48
21 CoreFoundation 0x0195d43e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
22 CoreFoundation 0x0189e5cb __CFRunLoopRun + 1963
23 CoreFoundation 0x0189d9d3 CFRunLoopRunSpecific + 467
24 CoreFoundation 0x0189d7eb CFRunLoopRunInMode + 123
25 GraphicsServices 0x038ec5ee GSEventRunModal + 192
26 GraphicsServices 0x038ec42b GSEventRun + 104
27 UIKit 0x00337f9b UIApplicationMain + 1225
28 QuizUsindDB 0x0001038d main + 141
29 libdyld.dylib 0x01e41701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Code for UIRefreshControl is given above:
-(void)pullToRefresh
{
self.refreshControl = [[UIRefreshControl alloc] init];
self.refreshControl.tintColor = [UIColor blackColor];
[self.refreshControl addTarget:self action:#selector(readScoreFromDatabase)
forControlEvents:UIControlEventValueChanged];
[self.myTable addSubview:self.refreshControl];
[self.refreshControl endRefreshing];
}
I have called [self pullToRefresh] in viewDidLoad .
I have the above code for initializing and calling a selector to refresh the table.
I am not able to recognise the error, can anyone point me out mistake.
Change this line:
[self.refreshControl endRefreshing];
To this:
[self.refreshControl beginRefreshing];
The endRefreshing method should be called after your table view has finished reloading data where necessary.
Also, the crash log indicates that your -[ScoreViewController readScoreFromDatabase]: function doesn't exist.

EXE BAD ACCESS Error from touching UIbutton which was dynamically created in a class

I am getting a memory error when I press my UIbuttons. I am creating these buttons dynamically in a custom class file, so everytime the class is called a certain number of buttons are created depending on the view controller. The code for their creation is as follows:
- (void)addTopicButtonsWithCount:(int)count andView:(UIScrollView*)referenceView
{
int i = 0;
for(NSString *theory in _chapterTheory)
{
[self makeButtonWithTitle:[NSString stringWithFormat:#"%#", self.chapterTheory[i][#"title"]] atPositionIndex:i andView:referenceView];
i++;
}
}
- (void)makeButtonWithTitle:(NSString *)title atPositionIndex:(NSInteger)index andView: (UIScrollView*)referenceView
{
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
button.frame = CGRectMake(80, 80+(60*index), 160, 40);
button.tag = index;
[button setTitle:title forState:UIControlStateNormal];
button.titleLabel.font = [UIFont systemFontOfSize:16];
button.titleLabel.textColor = [UIColor blackColor];
button.backgroundColor = [UIColor blackColor];
[button addTarget:self action:#selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
[referenceView addSubview:button];
}
Once the buttons are created I am trying to access them with this function:
- (void)buttonPressed:(UIButton *)sender {
NSLog(#"button %d pressed", sender.tag+1);
}
But I don't even get to this function, I've placed a break point on the first line this buttonPressed method, but the compiler never reaches this pint, it crashes beforehand. The buttons seem to be created fine, what have I missed?
Crash Log as requested:
2014-02-05 21:27:49.242 theoryDisplay[67820:70b] -[UIScrollView buttonPressed:]: unrecognized selector sent to instance 0x8d54180
2014-02-05 21:27:49.245 theoryDisplay[67820:70b] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIScrollView buttonPressed:]: unrecognized selector sent to instance 0x8d54180'
* First throw call stack:
(
0 CoreFoundation 0x0173b5e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x014be8b6 objc_exception_throw + 44
2 CoreFoundation 0x017d8903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x0172b90b ___forwarding___ + 1019
4 CoreFoundation 0x0172b4ee _CF_forwarding_prep_0 + 14
5 libobjc.A.dylib 0x014d0874 -[NSObject performSelector:withObject:withObject:] + 77
6 UIKit 0x0022e0c2 -[UIApplication sendAction:to:from:forEvent:] + 108
7 UIKit 0x0022e04e -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
8 UIKit 0x003260c1 -[UIControl sendAction:to:forEvent:] + 66
9 UIKit 0x00326484 -[UIControl _sendActionsForEvents:withEvent:] + 577
10 UIKit 0x00325733 -[UIControl touchesEnded:withEvent:] + 641
11 UIKit 0x005a0c7f _UIGestureRecognizerUpdate + 7166
12 UIKit 0x0026b19a -[UIWindow _sendGesturesForEvent:] + 1291
13 UIKit 0x0026c0ba -[UIWindow sendEvent:] + 1030
14 UIKit 0x0023fe86 -[UIApplication sendEvent:] + 242
15 UIKit 0x0022a18f _UIApplicationHandleEventQueue + 11421
16 CoreFoundation 0x016c483f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
17 CoreFoundation 0x016c41cb __CFRunLoopDoSources0 + 235
18 CoreFoundation 0x016e129e __CFRunLoopRun + 910
19 CoreFoundation 0x016e0ac3 CFRunLoopRunSpecific + 467
20 CoreFoundation 0x016e08db CFRunLoopRunInMode + 123
21 GraphicsServices 0x036e09e2 GSEventRunModal + 192
22 GraphicsServices 0x036e0809 GSEventRun + 104
23 UIKit 0x0022cd3b UIApplicationMain + 1225
24 theoryDisplay 0x0000371d main + 141
25 libdyld.dylib 0x01d7970d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Undeclared selector goBack warning and unrecognized selector sent to instance termination

I have been reading lots of similar questions and answers but still don't quite understand what's going wrong here.
I'm trying to create a button to go back to the previous view but I keep getting the errors mentioned in the title. Could someone advise me what I'm doing wrong?
UIImage *image = [UIImage imageNamed:#"listbutton.png"];
UIButton *listbutton = [UIButton buttonWithType:UIButtonTypeCustom];
listbutton.bounds = CGRectMake( 0, 0, image.size.width, image.size.height );
[listbutton setImage:image forState:UIControlStateNormal];
[listbutton addTarget:self action:#selector(goBack:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithCustomView:listbutton];
goBack:
- (void)goBack
{
[self.navigationController popViewControllerAnimated:YES];
}
error:
2014-01-05 22:03:13.344 tablepractice[12509:70b]
-[DetailViewController goBack:]: unrecognized selector sent to instance 0x8b72130 2014-01-05 22:03:13.348 tablepractice[12509:70b]
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[DetailViewController
goBack:]: unrecognized selector sent to instance 0x8b72130'
* First throw call stack: ( 0 CoreFoundation 0x017405e4 exceptionPreprocess + 180 1 libobjc.A.dylib
0x014c38b6 objc_exception_throw + 44 2 CoreFoundation
0x017dd903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275 3
CoreFoundation 0x0173090b __forwarding + 1019
4 CoreFoundation 0x017304ee
_CF_forwarding_prep_0 + 14 5 libobjc.A.dylib 0x014d5874 -[NSObject performSelector:withObject:withObject:] + 77 6
UIKit 0x002330c2 -[UIApplication
sendAction:to:from:forEvent:] + 108 7 UIKit
0x0023304e -[UIApplication sendAction:toTarget:fromSender:forEvent:] +
61 8 UIKit 0x0032b0c1 -[UIControl
sendAction:to:forEvent:] + 66 9 UIKit
0x0032b484 -[UIControl _sendActionsForEvents:withEvent:] + 577 10
UIKit 0x0032a733 -[UIControl
touchesEnded:withEvent:] + 641 11 UIKit
0x0027051d -[UIWindow _sendTouchesForEvent:] + 852 12 UIKit
0x00271184 -[UIWindow sendEvent:] + 1232 13 UIKit
0x00244e86 -[UIApplication sendEvent:] + 242 14 UIKit
0x0022f18f _UIApplicationHandleEventQueue + 11421 15 CoreFoundation
0x016c983f CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION
+ 15 16 CoreFoundation 0x016c91cb __CFRunLoopDoSources0 + 235 17 CoreFoundation 0x016e629e __CFRunLoopRun + 910 18 CoreFoundation
0x016e5ac3 CFRunLoopRunSpecific + 467 19 CoreFoundation
0x016e58db CFRunLoopRunInMode + 123 20 GraphicsServices
0x036e59e2 GSEventRunModal + 192 21 GraphicsServices
0x036e5809 GSEventRun + 104 22 UIKit
0x00231d3b UIApplicationMain + 1225 23 tablepractice
0x0000388d main + 141 24 libdyld.dylib
0x01d7e70d start + 1 25 ???
0x00000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught
exception of type NSException
[listbutton addTarget:self action:#selector(goBack:) forControlEvents:UIControlEventTouchUpInside];
This needs to be changed to not use a colon in the selector method:
[listbutton addTarget:self action:#selector(goBack) forControlEvents:UIControlEventTouchUpInside];
A colon implies that there is a parameter and your goBack method has no parameters.

Resources