{"id":4191,"date":"2014-03-30T09:10:00","date_gmt":"2014-03-30T09:10:00","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/thread-1-signal-sigbart-collection-of-common-programming-errors\/"},"modified":"2014-03-30T09:10:00","modified_gmt":"2014-03-30T09:10:00","slug":"thread-1-signal-sigbart-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/thread-1-signal-sigbart-collection-of-common-programming-errors\/","title":{"rendered":"Thread 1 signal SIGBART-Collection of common programming errors"},"content":{"rendered":"<p>I did some research on this, but alas, no answer. I have made a code machine that uses ASCII code. There are no errors or warnings. But when I run it I get this error: <strong>Thread 1: signal SIGBART<\/strong>. I think it has to do with UITextView &#8220;coded&#8221; but I don&#8217;t know for sure. EDIT: The crash occurs when I click the &#8220;Encode&#8221; button ((IBAction)StartEncodeDecode).<\/p>\n<p>All Output Log below. Can&#8217;t believe I&#8217;m such a noob:<\/p>\n<blockquote>\n<p>2013-08-28 14:00:57.086 Code Machine[2285:11303] -[CMViewController decodeEncode:]: unrecognized selector sent to instance 0x7151190 2013-08-28 14:00:57.155 Code Machine[2285:11303] <strong>* Terminating app due to uncaught exception &#8216;NSInvalidArgumentException&#8217;, reason: &#8216;-[CMViewController decodeEncode:]: unrecognized selector sent to instance 0x7151190&#8217; *<\/strong> First throw call stack: (0x1c94012 0x10d1e7e 0x1d1f4bd 0x1c83bbc 0x1c8394e 0x10e5705 0x192c0 0x19258 0xda021 0xda57f 0xd96e8 0x48cef 0x48f02 0x26d4a 0x18698 0x1befdf9 0x1befad0 0x1c09bf5 0x1c09962 0x1c3abb6 0x1c39f44 0x1c39e1b 0x1bee7e3 0x1bee668 0x15ffc 0x1ded 0x1d15) libc++abi.dylib: terminate called throwing an exception (lldb)<\/p>\n<\/blockquote>\n<p>End edit.<\/p>\n<p>Code is below:<\/p>\n<p>View Controller.m:<\/p>\n<pre><code>#import \"CMViewController.h\"\n#import \"CMAEncode.h\"\n\n@interface CMViewController ()\n@property (weak, nonatomic) IBOutlet UITextView *toCode;\n@property (weak, nonatomic) IBOutlet UITextView *coded; \/\/I think the problem is with this text view.\n@property (weak, nonatomic) IBOutlet UISwitch *onOrOff;\n\n- (IBAction)StartEncodeDecode:(id)sender;\n\n\n\n\n@end\n\n\n@implementation CMViewController\n\n\n- (void)viewDidLoad\n{\n    [super viewDidLoad];\n    \/\/ Do any additional setup after loading the view, typically from a nib.\n}\n\n- (void)didReceiveMemoryWarning\n{\n    [super didReceiveMemoryWarning];\n    \/\/ Dispose of any resources that can be recreated.\n}\n- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range\n replacementText:(NSString *)text\n{\n\n    if ([text isEqualToString:@\"\\n\"]) {\n\n        [textView resignFirstResponder];\n        \/\/ Return FALSE so that the final '\\n' character doesn't get added\n        return NO;\n    }\n    \/\/ For any other character return TRUE so that the text gets added to the view\n    return YES;\n}\n- (IBAction)StartEncodeDecode:(id)sender {\n\n    NSString *finishedText;\n    NSString *toCode = self.toCode.text;\n    if (self.onOrOff.on == FALSE) {\n        finishedText = [CMAEncode encodeText:toCode];\n        self.coded.text = finishedText;\n    } else { \n    }\n}\n\n@end\n<\/code><\/pre>\n<p>CMAEncode.m<\/p>\n<pre><code>#import \"CMAEncode.h\"\n\n@implementation CMAEncode : NSObject \n\n+ (NSString *) encodeText:(NSString *)text {\n\n    NSString *ToEncode = text;\n    NSMutableString *Encoded = [NSMutableString string];\n    int letter;\n    NSUInteger i = 0;\n\n    while (i &lt; ([ToEncode length] - 1)) {\n        letter = [ToEncode characterAtIndex:i];\n        NSString *toAppend = [NSString stringWithFormat:@\"%d|\", letter];\n        [Encoded appendString:toAppend];\n        i = i + 1;\n    }\n\n    return Encoded;\n\n\n\n\n}\n\n@end\n<\/code><\/pre>\n<p>Here&#8217;s the class where the error actually occurred. It&#8217;s call main.m:<\/p>\n<pre><code>#import \n\n#import \"CMAppDelegate.h\"\n\nint main(int argc, char *argv[])\n{\n    @autoreleasepool {\n        return UIApplicationMain(argc, argv, nil, NSStringFromClass([CMAppDelegate class])); \/\/This is where the error occurred.\n    }\n}\n<\/code><\/pre>\n<p>Thanks for helping!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I did some research on this, but alas, no answer. I have made a code machine that uses ASCII code. There are no errors or warnings. But when I run it I get this error: Thread 1: signal SIGBART. I think it has to do with UITextView &#8220;coded&#8221; but I don&#8217;t know for sure. EDIT: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4191","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4191","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4191"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4191\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}