I'm having some difficulty with NSString in my application. Basically, I have an NSString called o1string which contains the value "602". I want to output this in a UIAlertView alongside some other text.
votedmessage = [ NSString stringWithFormat:@"The current standings are as follows:\n\n%@: %@ votes", b1title, o1string ];
UIAlertView *votedAlert = [[UIAlertView alloc] initWithTitle:@"Thank you for voting" message:votedmessage delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
I have used NSLog and verified that the value inside the NSString is definitely 602, and the other variable (b1title) used in the message outputs fine on its own. I cannot work out why the app is crashing when I add the o1votes variable to the alert message though, is it something to do with a conflict in holding just a number inside an NSString?
This is how o1string is set. It definitely contains "602", grabbed from an XML file.
o1string = [[options objectAtIndex:3] objectForKey: @"votes"];
o1string = [o1string stringByReplacingOccurrencesOfString:@"\n" withString:@""];
o1string = [o1string stringByReplacingOccurrencesOfString:@" " withString:@""];