1

First of all, I can't even get a .plist to work as I believe it should below. I am just trying to write an NSNumber and retrieve it

self.paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
        self.documentsDirectory = [self.paths objectAtIndex:0];
        self.path = [self.documentsDirectory stringByAppendingPathComponent:@"data.plist"];
        self.fileManager = [NSFileManager defaultManager];
        NSError *error;
        if (![self.fileManager fileExistsAtPath:self.path]) {
            self.bundle = [[NSBundle mainBundle] pathForResource:@"data" ofType:@"plist"];

            [self.fileManager copyItemAtPath:self.bundle toPath:self.documentsDirectory error:&error];

        }

        self.dataForDict = [[NSDictionary alloc] initWithContentsOfFile:self.documentSlashAudioPath];
        int value = 5;
        [self.dataForDict setValue:[NSNumber numberWithInt:value] forKey:@"value"];
        [self.dataForDict writeToFile:self.path atomically:YES];

        self.number = [self.dataForDict objectForKey:@"value"];
        NSLog(@"%i", [self.number intValue]);

That last NSLog should be giving me a 5, but the output is 0.

I am trying to create a .plist file with audio in it for use with Sound Bank Player: http://www.hollance.com/2011/02/soundbankplayer-using-openal-to-play-musical-instruments-in-your-ios-app/

I know how to record a sound and play it back with AVAudioRecorder and AVAudioPlayer, now I just need to connect the dots.

paperview
  • 33
  • 1
  • 4

0 Answers0