Note that there are some explanatory texts on larger screens.

plurals
  1. POLoad data EXC BAD ACCESS (only device)
    text
    copied!<p>When my custom data is loading on iPhone (3G, with 3.1) I get Exc Bad Access in this line: </p> <pre><code>NSMutableArray* dataArr = [NSKeyedUnarchiver unarchiveObjectWithFile:pathGG]; //=EXC BAD ACCESS </code></pre> <p><strong>On Ipad, and on simulator work</strong></p> <p>I saving data in simulator (to documentsDirectory path), then replace data to project, and load from [NSBundle mainBundle]</p> <p>In array I use NSValue for store CGPoint.</p> <p>Full source:</p> <pre><code>-(void) SaveData:(NSMutableArray*)dataLevel { NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString* documentsDirectory = [paths objectAtIndex:0]; NSString* fileName = @"data.dat"; NSString* pathGG = [documentsDirectory stringByAppendingPathComponent:fileName]; // retain]; BOOL isWrite = [NSKeyedArchiver archiveRootObject:dataLevel toFile:pathGG]; if(isWrite) NSLog(@"YES"); else NSLog(@"!!!"); } +(NSMutableArray*) LoadData { NSString* fileName = @"data.dat"; NSString* pathGG = [[NSBundle mainBundle] pathForResource:fileName ofType:@"dat"]; // retain]; NSMutableArray* dataA = [NSKeyedUnarchiver unarchiveObjectWithFile:pathGG]; //EXC BAD ACCESS return dataA; } </code></pre> <p>If I am using follow way(saving/loading same method), I get EXC BAD ACCESS too:</p> <pre><code>NSKeyedUnarchiver* decoder = [[NSKeyedUnarchiver alloc] initForReadingWithData:data]; NSArray* dataArr = [decoder decodeObjectForKey:@"dataLevel"]; //EXC BAD ACCESS </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