Page 2 of 2
Re: RUMlogNG will not save preferences.
Posted: Mon 2. Mar 2015, 10:08
by DL2RUM
Charles, you started always with Menu–>Logbook–>New with RUMlog Classic file ?
What is happening when you create an empty log file using Menu–>Logbook–>New?
Re: RUMlogNG will not save preferences.
Posted: Mon 2. Mar 2015, 23:10
by k4zrj
When starting with a new, empty log, same results. Same errors generated.
3/2/15 18:04:34.000 kernel[0]: Sandbox: RUMlogNG(3765) deny file-read-data /Users/charlesjohnson/Documents/K4ZRJ.rlog
3/2/15 18:04:34.087 RUMlogNG[3765]: Error saving Logfile URL: The file “K4ZRJ.rlog” couldn’t be opened.
3/2/15 18:04:34.490 RUMlogNG[3765]: view service marshal for <NSRemoteView: 0x7fe530489a60> failed to forget accessibility connection due to Error Domain=NSCocoaErrorDomain Code=4099 "Couldn’t communicate with a helper application." (The connection was invalidated from this process.) UserInfo=0x60800066a400 {NSDebugDescription=The connection was invalidated from this process.}
timestamp: 23:04:34.489 Monday 02 March 2015
process/thread/queue: RUMlogNG (3765) / 0x103dce000 / com.apple.NSXPCConnection.user.endpoint
code: line 2972 of /SourceCache/ViewBridge/ViewBridge-46.2/NSRemoteView.m in __57-[NSRemoteView viewServiceMarshalProxy:withErrorHandler:]_block_invoke
domain: communications-failure
This happens when I manually open the log.
73, Charles, K4ZRJ
Re: RUMlogNG will not save preferences.
Posted: Tue 3. Mar 2015, 03:32
by DL2RUM
Do you have tried another file name? Okay, this is to simple, but I'm running out of ideas.
Re: RUMlogNG will not save preferences.
Posted: Tue 3. Mar 2015, 04:53
by k4zrj
Changing to a different file name makes no difference.
The issue involves sandboxing. The console messages I've sent show what the issue is.
Which OS are you developing on and which SDK and which version of Xcode?
Maybe if we could get the platforms equal, we could figure out what's wrong. You have the source and the project, I don't, so I can't help analyze console errors with out it.
73, Charles, K4ZRJ
Re: RUMlogNG will not save preferences.
Posted: Tue 3. Mar 2015, 06:50
by DL2RUM
After you created a new file, is the new file really on your disk?
What happens when you open this file using Menu-->Logbook-->Open?
Here the whole code for the menu action Menu-->Logbook-->New Any ideas?
Code: Select all
- (IBAction)menuLogNew:(NSMenuItem *)sender {
NSSavePanel* panel = [NSSavePanel savePanel];
[panel setTitle:NSLocalizedString(@"Select the location and a logbook filename", nil)];
[panel setCanCreateDirectories:YES];
[panel setCanSelectHiddenExtension:NO];
[panel setAllowedFileTypes:@[@"rlog"]];
[panel setTreatsFilePackagesAsDirectories:NO];
[panel beginWithCompletionHandler:^(NSInteger resultPanel) {
if (resultPanel == NSFileHandlingPanelOKButton) {
NSURL* saveURL = [panel URL];
NSFileManager* fileManager = [NSFileManager defaultManager];
NSString* pathFromApp = [[NSBundle mainBundle] pathForResource:@"EmptyLog" ofType:@"rlog"];
NSError* error;
[fileManager copyItemAtPath:pathFromApp toPath:saveURL.path error:&error];
if (error) {
NSAlert* al = [[NSAlert alloc] init];
al.alertStyle = NSWarningAlertStyle;
al.messageText = NSLocalizedString(@"Can't create new logfile:",Nil);
al.informativeText = error.localizedDescription;
[al runModal];
} else {
NSUserDefaults* prefs = [NSUserDefaults standardUserDefaults];
error = nil;
NSData* bookmarkData = [[panel URL] bookmarkDataWithOptions:NSURLBookmarkCreationWithSecurityScope includingResourceValuesForKeys:nil relativeToURL:nil error:&error];
if (!error) {
[prefs setObject:bookmarkData forKey:@"LogFileUrlStringSecured"];
[prefs synchronize];
} else {
NSLog(@"Error saving Logfile URL: %@ ",error.localizedDescription);
}
}
}
}];
}
Re: RUMlogNG will not save preferences.
Posted: Tue 3. Mar 2015, 19:31
by k4zrj
Tom,
I added your code to one of my projects and it compiles OK but I need your list of entitlements (the code fails to create the NSSavePanel).
73, Charles, K4ZRJ
Re: RUMlogNG will not save preferences.
Posted: Wed 4. Mar 2015, 04:02
by k4zrj
Tom,
Please disregard previous post.
This code fails under sandboxing, but works if sandboxing is turned off. I had to make two small changes in order to get a clean compile in the app that I added the code to:
NSFileManager* fileManager = [NSFileManager defaultManager];
// NSString* pathFromApp = [[NSBundle mainBundle] pathForResource:@"EmptyLog" ofType:@"rlog"];
NSError* error;
// [fileManager copyItemAtPath:pathFromApp toPath:saveURL.path error:&error];
[fileManager copyItemAtPath:@"/Users/charlesbjohnson/Documents/K4ZRJ.rlog" toPath:saveURL.path error:&error];
I am no expert on sandboxing, so I can't say why it fails for me and apparently not for other people, but tracing the code shows an error -503 when fileManager is called to do the copy. However, when I run your app and select a new log, it does create the empty rlog file in the correct folder. However, the app can't reopen it.
73, Charles, K4ZRJ
Re: RUMlogNG will not save preferences.
Posted: Wed 4. Mar 2015, 05:53
by DL2RUM
I don't know what the problem is, but i found similar issues with other applications, even an Apple app. Same error messages. But nobody can explain it. Some ideas are:
- Is any Anti Virus software running?
- Parental Control activated?
- Any system tools installed?
For any reason, the system don't allow you to read the files.
Can you test it on another user or guest account?
Re: RUMlogNG will not save preferences.
Posted: Wed 4. Mar 2015, 21:33
by k4zrj
Tom,
All is well. Your code snippet works OK under sandboxing.
I copied the resource file EmptyLog.rlog from the package contents of your app and added it as a resource file in the bundle of my app and then executed your code without any changes under sandboxing. The new "empty" log file is created wherever I tell NSSavePanel to put it. No errors logged that relate to sandboxing.
So, the problem of not being able to reopen the log file is elsewhere in your code. What about the code that reads the container preferences and extracts "LogFileUrlStringSecured"?
Sandboxing normally forces a user to manually open files, but in the case where the app was closed with a sandboxed file open, it should automatically reopen the file. For some reason, this is not happening.
Sorry for the previous inaccurate reply. I had not tried to use your EmptyLog.rlog bundle file, but created my own and how I accessed it violated sandboxing.
I'll be glad to look at more code...
73, Charles, K4ZRJ