I access to a specific element of a NSMutableArray (nid) and save it in a NSString (num).
After that I want concatenate this element (num) with a url (NSMutableString), and use the method appendString but I obtain an exception.
how can I fix this?
below the code:
NSMutableArray nid;
....
NSUInteger row = [indexPath row];
NSString *num = [nid objectAtIndex:row];
NSMutableString *url = [[NSMutableString alloc]
initWithString:@"http://example.com/prova/"];
[url appendString:num];
As per the exception, it looks like
objectAtIndex:is returning aNSNumberinstead of aNSString. Ifnidcontains numbers, you need to convert them to strings before you can pass them toappendString: