+ Reply
Results 1 to 2 of 2

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 the

OS Apps and Development

forums, a part of the

Computer 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 =
...
  1. #1
    What's Jailbreak?
    Join Date
    Apr 2011
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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!

  2. #2
    Developer NetMage's Avatar
    Join Date
    Aug 2007
    Location
    Virginia
    Posts
    1,296
    Thanks
    72
    Thanked 210 Times in 168 Posts

    In these two lines:
    Code:
    NSArray *FileArray = [File componentsSeparatedByString:@"\n"];
    NSMutableDictionary *FileArray = [[NSMutableDictionary alloc] init];
    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.
    Starlight Computer Wizardry
    Pocket-sized Development
    Follow me on twitter: @NetMage

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts