Note that there are some explanatory texts on larger screens.

plurals
  1. POCan not load an archived NSMutableArray into a new NSMutableArray
    text
    copied!<p>The App will save the NSMutableArray into a archive with no problems but as soon as I try and load the NSMutableArray back into a new NSMutableArray @ viewDidLoad the app will crash. I put a break point at the end of the code where "tempArray = [unarchiver decodeObjectForKey:kDataKey46];" and tempArray is being loaded with the archived array but when I go through the "for" loop @ "[poolListData addObject:testTemp];" "poolListData" does not hold the data from "tempArray". Also if I did not use a break point and just let the app try to load, the app will crash...What do you guys think?</p> <p>Thank you for your time! Jeff</p> <pre><code> NSString *filePath = [self dataFilePath]; if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) { NSData *data = [[NSMutableData alloc] initWithContentsOfFile:[self dataFilePath]]; NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:data]; field1.text = [unarchiver decodeObjectForKey:kDataKey1]; // snip another bunch of fields field37.text = [unarchiver decodeObjectForKey:kDataKey37]; soundOn = [unarchiver decodeBoolForKey:kDataKey38]; soundVolumeSlider.value = [unarchiver decodeDoubleForKey:kDataKey39]; soundVolumeValue = [unarchiver decodeDoubleForKey:kDataKey39]; tempArray = [unarchiver decodeObjectForKey:kDataKey46]; [unarchiver finishDecoding]; for(int i = 0; i &lt; [tempArray count]; i++) { NSData *testTemp = 0; //NSString *temp = [tempArray objectAtIndex:i]; testTemp = [tempArray objectAtIndex:i]; [poolListData addObject:testTemp]; //[poolListData addObjectsFromArray:tempArray]; } /* firstNameTextField.text = field1.text; lastNameTextField.text = field2.text; adressTextField.text = field3.text; emailTextField.text = field4.text; */ [tempArray release]; [unarchiver release]; [data release]; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload