Heya, my first post here. I've been trying my hardest to write an iPhone app and while I've made good progress, I've hit a stumbling block on something which seems simple enough, but just refuses to work.
I'm writing a simple 'terminal' application to connect to a server, send data, display data, figured that'd be a good starting block.
At the moment all the data coming in gets inserted into a NSMutableArray, I figured this way I could limit the history to say 100 packets worth of data rather than just appending it all into a single string which would be hard to tidy up.
The problem i'm having is displaying the entire contents of the array in a textview. By default I have two objects in the array to test it with.
This works fine, and I can change the index to 0 and 1 and it still works..
But this falls on it's arse and causes an uncaught exception..
I've scoured the net for days over this silly little problem, and can't find any examples other than ones which do it how I am doing it.
Any suggestions?
Thanks in advance.
I'm writing a simple 'terminal' application to connect to a server, send data, display data, figured that'd be a good starting block.
At the moment all the data coming in gets inserted into a NSMutableArray, I figured this way I could limit the history to say 100 packets worth of data rather than just appending it all into a single string which would be hard to tidy up.
The problem i'm having is displaying the entire contents of the array in a textview. By default I have two objects in the array to test it with.
This works fine, and I can change the index to 0 and 1 and it still works..
Code:
NSMutableString *tmp = [[[NSMutableString alloc] init] autorelease];
tmp = [rawData objectAtIndex:0];
textView.text = tmp;
But this falls on it's arse and causes an uncaught exception..
Code:
NSMutableString *tmp = [[[NSMutableString alloc] init] autorelease];
int count = [rawData count];
int i = 0;
while (i < count)
{
[tmp appendString:[[rawData objectAtIndex:i] stringValue]];
i++;
}
textView.text = tmp;
I've scoured the net for days over this silly little problem, and can't find any examples other than ones which do it how I am doing it.
Any suggestions?
Thanks in advance.