Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.
Thread: Error when trying to change .txt to array to .plist
is a discussion within theOS Apps and Development
forums, a part of theComputer Modding Software
section;im trying to change a text file with per line information to a plist so i can read the array info for other things. the code is: NSString *File =
...-
11-21-2011, 06:38 PM #1
Error when trying to change .txt to array to .plist
im trying to change a text file with per line information to a plist so i can read the array info for other things. the code is:
NSString *File = [NSString stringWithContentsOfFile:@"/var/mobile/Example.txt"];
NSArray *FileArray = [File componentsSeparatedByString:@"\n"];
NSMutableDictionary *FileArray = [[NSMutableDictionary alloc] init];
[FileArray setObject:itemsArray forKey:@"Saved"];
[FileArray writeToFile:@"/var/mobile/Array.plist" atomically:YES];
i keep getting errors like FileArray is already defined.
Please Help!
-
12-07-2011, 12:17 AM #2
In these two lines:
you are telling the compiler you want a variable named FileArray of type NSArray and a variable of type NSMutableDictionary named FileArray - one variable can't be both at once.Code:NSArray *FileArray = [File componentsSeparatedByString:@"\n"]; NSMutableDictionary *FileArray = [[NSMutableDictionary alloc] init];




LinkBack URL
About LinkBacks
Reply With Quote