How many paragraphs in a text view?

Hello,

In order for my user to easily edit a plist file, I want to present it into a NSTextView. It is a (mutable) array of (mutable) dictionaries converted in lines (one line per dictionary) of words separated with tabs (the keys). So, for example:
lastname1 firstname1
lastname2 firstname2

I already have my plist presented in such a text, I did so:

My problem is: how to put back the modified text into the dictionary? I tried this – of course everything freezes:

[__NSCFString countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x7f83c5132f80

Well, I’m stuck. Can you help me please ?

I’m not sure of your problem, but this works fine here:

		    NSString *tempText = @"One\tTwo\nThree\tFour";
		    NSArray *linesArray =[tempText componentsSeparatedByString:@"\n"];
		    for (NSString *oneLine in linesArray){
		        NSLog(@"oneLine is «%@»",oneLine);
		        if (![oneLine isEqualToString: @""]){ // avoid blank lines!
		        NSArray *oneRecord= [oneLine componentsSeparatedByString:@"\t"];
		        NSDictionary *newRecord = [NSDictionary dictionaryWithObjectsAndKeys:[oneRecord objectAtIndex:0], @"lastName",[oneRecord objectAtIndex:1], @"firstName", nil];
		        NSLog(@"%@",newRecord);
		        }
		    };

Thank you Shane,

It was not a strict code error, it was a problem with bindings. You replaced the line

    NSString *tempText = self.convertedText;

with

    NSString *tempText = @"One\tTwo\nThree\tFour";

so the error had to come from here. convertedText was bound to the text view’s attributedString. As soon as I edited something, the app just looked like the Death Star at the end of the movie.

I replaced this line with NSString *tempText = [theTextView string]; and everything works fine now. I just had to put these records into an array and add:

[dictionary setObject: forKey:];

What a relief. I couldn’t figure out what was wrong in the code.

Thank you!