error in my code to handle nsstring

i have an error in this code

NSString *str = @"above string"; //load above string here
NSArray * firstArry = [str componentsSeparatedByString:@"#"];
NSMutableArray *secondArry = [[NSMutableArray alloc] init]; //Will hold the # titles
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; //Will hold the strings related to # title
for(NSString firstArryStr : firstArry)
{
    NSArray *tempArry = [firstArryStr componentsSeparatedByString@"\n"];
    NSMutableArray *titleStingsArry = [[NSMutableArray alloc] init];
    for (int i=0; i< [tempArry count];i++)
    {
        if (i==0)
        {
            NSString *title = [tempArry  objectAtIndex:i];
            [secondArry addObject:title];
            [dict setValue:titleStingsArry  forKey:title];
        } else {
            [titleStingsArry  addObject:[tempArry  objectAtIndex:i]];
        }
    } 
 }

the error is on the first "for".

this is a code to handle that :

# 2012
20120604 Huge Sandstorm over Saudi Arabia
20120527 Huge Sandstorm over niger
# 2012
20110330 Huge Sandstorm over niger
# just for the test
20110330 AHuge Sandstorm over niger
20110330 BHuge Sandstorm over niger
20110330 CHuge Sandstorm over niger
20110330 1Huge Sandstorm over niger
20110330 2Huge Sandstorm over niger
20110330 3Huge Sandstorm over niger
20110330 4Huge Sandstorm over niger
20110330 5CHuge Sandstorm over niger
20110330 6Huge Sandstorm over niger
# **********
20110330 7Huge Sandstorm over niger
20110330 8Huge Sandstorm over niger
20110330 9CHuge Sandstorm over niger
20110330 AHuge Sandstorm over niger
20110330 B10CHuge Sandstorm over niger
20110330 **CHuge Sandstorm over niger

in a UITableView with different sections where the title will be the # ....... and the content 20110330 ........ 20110330 ........ 20110330 ........

someone can please help me?

Answers


use the for method is ...

for(NSString *firstArryStr in firstArry)
{

             //Put your all code here 
}

Hope this will resolve your problem


Use:

for(NSString *str in firstArry)

Need Your Help

Why does Tomcat 5.5 (with Java 1.4, running on Windows XP 32-bit) suddenly hang?

java windows tomcat

I've been running Tomcat 5.5 with Java 1.4 for a while now with a huge webapp. Most of the time it runs fine, but sometimes it will just hang, with no exception generated, and no apparant way of g...

Does Visual Studio local machine run on a different resolution?

visual-studio-2013 winrt-xaml

I'm working on a pretty basic Windows app and I was hoping to programmatically resize items based on the resolution (of the app). I am using this code which was suggested on another thread.