We are developing a document-based Objective-C project, using NSPersistentDocument and NSPersistentStore to save a unique binary file on disk. No autosave.
One customer has a recurring saving issue
The document "something.extension" could not be saved
that we cannot reproduce in our development setup. They can load their saved file without issue, but after a few changes the error pops up when trying to save. In our own setup, using the same build, the file opens and saves without issue.
The error is too vague for us to pinpoint the exact reason why their document would not save, but based on the very basic error message, we have realised the error raised is NSFileWriteUnknownError = 512.
In which situation would that error be raised? In which situation wouldn't the other, more specific error codes be applicable?
We build using SDK 10.14 and both us and the customer run on macOS Monterey 12.3.1
EDITED ON 09/08/22 - Added details based on Willeke's comments.
EDITED ON 17/08/22 - Underlying error
The error's userInfo comes with an underlying error message, which our customer could display. It states "No known persistent store for URL"
Related
We have this trouble:
We have been changing styles in our ITS Mobile applications, due to we have acquired new handhelds which are Android and the one we are replacing are Windows OS.
We have always used the WebGui style but the new handhelds with Android can't show popups and that's why we are transforming the styles to MOBILE4 and because, according to SAP, WebGui style is obsolete now.
The problem is that, when testing in Q&A, we are having dumps when we access the applications through handhelds, both Windows and Android.
The dumps show this:
The template zitsmobile\99\zmm_dynnr_50.html
contains syntax errors and therefore could not be compiled. Cause of
error: Include "include/sound" does not exist
The syntax error is in row: 50, column: 87
The HTMLB row with errors is:
" include(~service="itsmobile", ~language="", ~theme="99",
~name="include/sound.html");"
We tried to change the style to just MOBILE but dump is another message:
The template zitsmobile\99\zmm_dynnr_50.html
contains syntax errors and therefore could not be compiled. Cause of
error: Include "include/sound" does not exist
The syntax error is in row: 33, column: 87
The HTMLB row with errors is:
" include(~service="itsmobile", ~language="", ~theme="99",
~name="include/sound.html");"
Screen:
500 Internal Server Error
Template interpretation terminated, syntax error.
UPDATE:
We tried to change the style and problems in that server arose.
In fact, we notice that template RLMENU 2888 file is different in between Q&A environment and production environment.
If we try to regenerate template RLMENU 2888 then all the other applications trigger dumps.
So, regenerating template RLMENU 2888 makes it worse.
We are really confused of what to do in this case.
I finally fixed the issue.
The cause of the problem was that the ITSMOBILE internet service was not published in production.
When we published it finally the resource INCLUDE/SOUND and the rest were available.
However we had an issue after publishing.
We had to apply the SAP Note 2221538 - ITS_UNEXPECTED_TOKEN or ITS_UNDEFINED_NAT_FUNCTION dumps in ITSmobile application because there was a dump were we had to add declare the sh() function in INCLUDE/CUAAREA.html in ITSMOBILE.
The error in dump was ITS_UNDECLARED_FUNCTION.
I want to be able to read a crash log and send it to my server. I've seen libraries that do this, and I'm actually basing my code on them -- except many of them seem out of date, which is why I believe I'm currently having a problem with OSX sandboxing.
There seem to be 2 parts to any generated crash log. In /Users/zane/Library/Containers/**[BUNDLE_ID]**/Data/Library/Application Support/CrashReporter there is a .plist with not much information. One thing it does contain, though, is a Path to ~/Library/Logs/DiagnosticReports/**FULL_CRASH_FILE**.crash
However, when I try to open this full path via [NSString stringWithContentsOfFile...] I get a read access error:
Error Domain=NSCocoaErrorDomain Code=257 "The file “Aftermath_2014-02-12-210934_inZania.crash” couldn’t be opened because you don’t have permission to view it." UserInfo=0x600000264700 {NSFilePath=/Users/zane/Library/Logs/DiagnosticReports/Aftermath_2014-02-12-210934_inZania.crash, NSUnderlyingError=0x600000246900 "The operation couldn’t be completed. Operation not permitted"}
I take it that this is a problem with entitlements/sandboxing. Is there any way I can gain access to this file, or otherwise get a full stack trace to send to my crash reporter?
You can check the permissions of the log file!! It may need root permissions to access!
I am trying to develop a standard when I code applications.
I was curious as to what other developers did when it comes to sql errors or general program errors. Do you output the error to the screen, write to a log file, or something else?
It really depends on the severity of the error.
Is it a show stopper?
Can the software automatically retry and get away with no message?
Can it be ignored?
You can log every exception, or just certain ones, or none. I have a custom Exception class which logs every exception created (of that type).
I have an unhandled exception handler which emails me when there is one.
I'd only send a message to the user when it will change the way the application works from the user's point of view.
Your question is a bit subjective and you would get opinion-based answers if the entire community bothered to answer.
If the error is relevant and important to the user (e.g.: invalid username/password) display it to the user using a message box.
If the error is relevant to the developer, or can be used in the debugging process, use a log or a console output.
The trick is to identify which and how the errors should be displayed to the user. You don't want to bombard the user with exceptions and complicated errors on which the user has no idea on how to act upon.
I have this weird thing that keeps happening when trying to use the following unit:
XLSReadWriteII 5
Every time I add one of their components to my form and compile it, it gives me the following error:
[dcc32 Fatal Error] Unit1.pas(16): F1026 File not found: 'C:\Users\Gordon\Documents\RAD Studio\Projects\grdi\Clipbrd.dcu'
This tells me that there is no DCU's in my API, no I get the same error on my windows 7 and my windows 8 pc's. Delphi was installed from the embarcadero website via their installer.
If I download a clipboard.dcu and .pas file and run it again it gives me the same error saying Graphics.duc is missing...
I have emailed the company Axolot Data (the creators of XLSReadWrite 5) with regards to this issue, they just keep telling me my API is corrupt, on both pc's??
However what I find strange is that their supplied samples run.
How can I fix this?
I think I have found a solution or reason this is happening.
XLSReadWrite 5 is a VCL component which references the VCL API, im using FMX.
The package was designed for VCL and not FMX but for some reason shows up in the FMX Units.
Strange but that might be my cause
Generally, in software design, which of the options below is preferred when there is a problem or error with a resource such as a database or file?
Show an error message
Do not show an error message and act as though the resource was empty (eg. do not populate a GUI component)]
For example, should the user see an empty DataGrid following which they complain, or should there be an error message? Which is better?
I don't see this as an either/or. Also, we need to consider all "users" of the system.
First consider the UI. Let's consider a contrived general case: you are populating a UI by calling a service which in turn uses a couple of of databases (for example a "current data" and an "historic data") database.
There are at least these possibilities:
It all works, data is retrieved
It all works but as it happens there's no data for this particular query
Can't reach the service
Service is invoked, but one database is down
Service is invoked, but both databases are down
Then also consider your application's semantics. Can your applciation procede in a "degraded" mode if all the data cannot be retrieved? For example, we can't query the history but that doesn't stop us creating a new item.,
Now also consider the roles here. There's the person using the UI, there's also support and maintenance people who need to know about and fix problems.
My general rules:
First Failure Data capture: Whichever component first detects an error should log it in some detail. So, service up, database down the service should log the problem. Service down, the UI should log the problem. This log should be a technical record targeting the support roles.
UIs should be tolerant: if at all possible run in a degraded mode. So if the service is down but (for example) local working is possible put up an empty screen and continue. BUT ...
Always indicate a problem: The "no data for this query" and "databases unavailable" cases may both result in an empty screen. The user needs to know the status of the display, is it showing complete information, partial information (eg. because one DB is down) or is no information available (eg. service or both dbs down). So have a "Status" field somewhere on the screen. Giving messages such as
Historica Data not currently available
or
There are problems retrieveing
information, if these persist please
contact support ...
There are some pitfalls to each of the options
Showing error message
This is specially helpful when your application is in testing stage or public testing. Also when clients meets an error, he or she can copy down the details and forward to you.
However sometimes this error message gets very ugly (call stacks and so on - remember ASP.NET?) and it becomes so large that it becomes difficult for clients to copy down the details.
Do not show error message and act as though nothing happened =)
This is useful when you don't want error messages to cog up your software UI design. But be reminded that it becomes difficult and further error prone when clients can't differentiate between an actual error, or really nothing on the GUI. The error stays there and nothing gets fixed.
My stand
Get the best of both worlds. In fact most modern applications how have a very good error handling process. I'll take the example of Mozilla Firefox 3.
A deadly error occurred and Firefox crashes
Error is captured and stored into a file as a form of error report
Error Reporting Application pops up apologizing to the user
Ask the user if the user want to send the error report to the software dev team
Then ask the user if want to restart the application
Or if the error is a warning or of lesser severity:
Show a simple error code and tell the user that there's the error with that action. Something like: "Error 123 at RequestSalary() Line 2"
The practice I usualy use is:
If the error didn't happen due to user error, then you should try to handle the error quietly.
If the error occurred because of some external problem (such as no internet connection) then you should alert the user.
IMO you should show a message (albeit a user friendly one and not something like "java.io.IOException: Connection timed out".) You could have a message box telling the user that an error occured while getting the data and provide helpful tips like: Trying after some time, check network cable, etc.
Also allow user to report that error to you (error reporting build into the app) that will send you the actual error and stack trace.