View Single Post
  #11 (permalink)  
Old February 9th, 2012, 02:34 PM
GeezerRoy GeezerRoy is offline
Registered User
Points: 34, Level: 1
Points: 34, Level: 1 Points: 34, Level: 1 Points: 34, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2010
Location: Fairfax, VA
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Default Optional Code when Not Found

Thanks for that new code and the placement of it. I needed that information also.

Here is a slightly modified version that I tried (and it worked) for when the text file was not found; i.e., setting mydata with the default table values:


if (textFileContents == nil) {

NSLog(@"Error reading text file. %@", [error localizedFailureReason]);

myData = [[NSArray alloc] initWithObjects:@"Albert", @"Bill", @"Chuck", @"Dave", @"Ethan",@"Franny", @"George", @"Holly", @"Inez", nil];

}
else {

myData = [textFileContents componentsSeparatedByString:@"\n"];

}