Archived Forum Post

Index of archived forum posts

Question:

CkoMHT not embedding images on OS X Mountain Lion (10.8.2)

Jan 12 '13 at 14:36

I'm using CkoMHT to read in a HTML file (and all referenced images) into my application. The data is then stored in the applications container (in the sandbox). This was all working fine until recently. Now it's like the component isn't seeing any of the local images referenced in the HTML file. Remote files are embedding just fine.

My code is based on http://www.example-code.com/objc/mht_extractHtmlObjects1.asp - and I should re-iterate - this was working just fine until recently. I'm using the latest libs (and xcode 4.5.2).

Please note that I've tried creating a security scoped URL but this doesn't appear to have any effect.

Any thoughts? thanks.


Answer

Examine the contents of the LastErrorText.


Answer

Reports the following:

externalContent:
          contentLocation: sligo-test.gif
          contentCID: CID-5f421114-5d0d-315d-41be-f03bf0108673
          filePath: sligo-test.gif
          loadingFile1: /Users/hill/Documents/sligo-test.gif
          fopen_failed:
            errno: 1
            osErrorMessage: Operation not permitted
            Failed to open file.
            mode: r
            path: /Users/hill/Documents/sligo-test.gif
          --fopen_failed
          Failed to download or include external content.
          contentPartTime: Elapsed time: 8 millisec
 --externalContent


Answer

When an application is working fine and then suddenly stops working, it's usually an indication that something external has changed to cause the problem (possibly networking, operating system permissions/security, filesystem permissions/security, user accounts, etc.). The LastErrorText indicates a failure to open a file in the local filesystem, and the error returned from the underlying OS X runtime lib is "Operation not permitted". My suggestion would be to Google using search terms that include "OS X", "fopen", "file open", and "operation not permitted". I suspect the solution will involve directory permissions, user account permissions, file locking, or anything else that might prevent a file from being opened. Unfortunately, sometimes OS error messages are non-descript and don't point to the specific cause of the problem.