Skip to content

Instantly share code, notes, and snippets.

@mikeymicrophone
Created May 26, 2010 18:07
Show Gist options
  • Save mikeymicrophone/414831 to your computer and use it in GitHub Desktop.
Save mikeymicrophone/414831 to your computer and use it in GitHub Desktop.
NSString *plist_path = [NSHomeDirectory() stringByAppendingPathComponent:@"audio_recording_number.plist"];
NSLog(@"plist path: %@", plist_path);
NSLog(@"file exists: %i", [[NSFileManager defaultManager] fileExistsAtPath:plist_path]);
if ([[NSFileManager defaultManager] fileExistsAtPath:plist_path]) {
NSLog(@"found audio config file");
} else {
NSLog(@"did not find audio config file");
audio_recording_number = [NSNumber numberWithInteger:0];
NSDictionary *audio_properties = [NSDictionary dictionaryWithObject:audio_recording_number forKey:@"number_of_recordings"];
[audio_properties writeToFile:plist_path atomically:YES];
}
2010-05-26 14:07:51.323 flower[40853:207] plist path: /Users/mschwab/Library/Application Support/iPhone Simulator/3.1.3/Applications/084FD774-FBD7-4EDC-AFE9-B3FB2A0552A8/audio_recording_number.plist
2010-05-26 14:07:51.324 flower[40853:207] file exists: 0
2010-05-26 14:07:51.325 flower[40853:207] did not find audio config file
mschwab$ cat /Users/mschwab/Library/Application\ Support/iPhone\ Simulator/3.1.3/Applications/084FD774-FBD7-4EDC-AFE9-B3FB2A0552A8/audio_recording_number.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>number_of_recordings</key>
<integer>0</integer>
</dict>
</plist>
@mikeymicrophone
Copy link
Author

the console output indicates that the fileManager cannot confirm that the file exists at that path.

however, when I built this code against the 3.2 SDK, it worked properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment