0

If i have a string like "Help, Support and More" in an NSArray which is content of an UITableView it crashes on startup. If i remove the whitespace after "," there is no Problem.

Is there any solution for this?

This crashes:

cell.textLabel.text = @"Help, Support and More";

This works:

cell.textLabel.text = @"Help,Support and More";

Here is more code:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
        //cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }

    // Configure the cell.
    NSLog(@"%@", [[sportstypes objectAtIndex: [indexPath row]] title]);
    cell.textLabel.text = @"Tes t:, ,,,,,";
    //cell.textLabel.text = @"Blubber";

    return cell;
}

FIX: Xcode 4.6.2 app crashes on every second run Thanks to ice_2

Community
  • 1
  • 1

3 Answers3

0

I think you are doing something wrong. Because your code is correct no problem in your code and second thing you can put any special character in double quot " ". It wont create any problem.

Dharmbir Singh
  • 17,485
  • 5
  • 50
  • 66
0

This may be because of memory issue.Make sure the array is not deallocated or removed anywhere.Enable zombie and run it so that you can recieve some log in the debugger console

Issue may be in this line

NSLog(@"%@", [[sportstypes objectAtIndex: [indexPath row]] title]);

comment it and execute and see for yourself what happens

Lithu T.V
  • 19,955
  • 12
  • 56
  • 101
0

If you get error Thread 1: signal SIGABRT on every second launch. Please open the menu Product -> Scheme -> Edit Scheme, select Run YouAppName.app on the left, tab Info. Then choose GDB instead of LLDB in debugger field.

Seems to be a combination of OS X 10.8.4 and LLDB. As kenster says, switching to GDB makes the problem go away.

p.balmasov
  • 357
  • 1
  • 16
  • This is all i got from GDB:GNU gdb 6.3.50-20050815 (Apple version gdb-1824) (Wed Feb 6 22:51:23 UTC 2013) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "x86_64-apple-darwin".sharedlibrary apply-load-rules all Attaching to process 4202. Current language: auto; currently objective-c (gdb) – mrequalizer Jun 06 '13 at 10:06
  • After this the app is dead. – mrequalizer Jun 06 '13 at 10:07
  • what osx version you have? – p.balmasov Jun 06 '13 at 10:10
  • i updated this morning to 10.8.4. I tried something, reverted it back and now the crash is no more reproduceable. – mrequalizer Jun 06 '13 at 10:13