Błąd uprawnień podczas zapisywania pliku (sandbox)
Próbuję zapisać plik na ścieżce w aplikacji piaskownicy [OS X], ale jak dotąd pojawia się błąd prawie za każdym razem, gdy próbuję go zapisać. Błąd jest ...
Error saving: Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “test.txt” in the folder “Testing”." UserInfo=0x1001f5e70 {NSFilePath=/Users/Seb/Desktop/Testing/test.txt, NSUnderlyingError=0x1001f5d70 "The operation couldn’t be completed. Operation not permitted"}
Ustawiłem „User Selected File” moich uprawnień na „Read / Write Access”.
Mój kod ..
NSString *saveLoc = [NSString stringWithFormat:@"%@/%@.txt",[[NSURL URLWithString:[[NSUserDefaults standardUserDefaults] valueForKey:@"saveURL"]] path],self.theWindow.title];
NSURL *saveURL = [NSURL fileURLWithPath:saveLoc];
NSLog(@"Saving to: %@",saveLoc);
NSError *err = nil;
[self.textView.string writeToURL:saveURL atomically:YES encoding:NSUTF8StringEncoding error:&err];
if (err) {
NSLog(@"Error saving: %@",err);
[[NSAlert alertWithError:err] beginSheetModalForWindow:self.theWindow
modalDelegate:nil
didEndSelector:NULL
contextInfo:nil];
}
Co ja robię źle? Jak mogę zapisać plik?
Dzięki.