How Do I Embed Local HTML into Cocoa Binaries? - objective-c

I'm using Objective C for a Cocoa application on OSX with some local HTML files that get loaded into a Webkit widget. However, a virus could easily modify those HTML files. So, I added a CRC hash to detect tampering, which shows a warning and then closes the application. However, is there a way to additionally protect the local HTML further such as compiling it into the binary of the application itself, or compiling into a single resource file? I noticed with Qt that they have a way to put the HTML into a resource file and then change the webkit URLs to load from there instead of file://. But this is Objective C in this case.

It's not possible from Objective C or Swift like it is from Qt. There is no HTTP URL that you can pass to the WebKit widget to pull content out of the Asset Catalog.

Related

How to run SCORM.zip file URL in objective c

How to run SCROM.zip file URL in objective c?
I download the SCORM API zip file and course zip file. But it's nothing to show index.html of course zip file. How can I run this course zip file with SCORM API zip in Objective C?
Basically you can't. First you can't "run" a zip file as it isn't runnable. You need to unzip it, and in the SCORM case what is inside will be a manifest file along with HTML files and their supporting assets. A particular HTML file (determined by the contents of the manifest file, imsmanifest.xml) will need to be rendered in a browser context, specifically one that supports a full JavaScript runtime. Additionally the SCORM RTE will need to be made available in that JS runtime.
See https://scorm.com/scorm-explained/technical-scorm/ for a lot more about SCORM.

OData and Objective C

I am trying to develop an ipad app that would interact with SQL server.Simple. So, i used WCF web service. I am getting the data there as xml. now, i want to develop an objective c client that would consume it. So, i used the odatagen tool to generate proxy. I did that and i got 2 files xyz.h and xyz.m. No more files. Now i have included them in my project. But in the xyz.h file i have error that says "import "OdataObject.h" file not found. I have done the header search path and library search path settings. What is missing.?
You have to include in your project the files that you should have in the OData4ObjC repository you cloned from github (or codeplex):
the .a library located in the /framework/bin/odatalib/lib/-yourplatform-/-yourversion-
all the files located in the /framework/bin/odatalib/include folder

Shared library and localizable.strings

I have created a shared library using Xcode 4.2 and objective c. My library includes a strings resource file that contains error messages. I then created a test application that loads and uses my library. I can't get to the string resource unless I manually copy the localizable.strings file into my test application project. Is there a way to access the resources contained in a library directly without copying to resource file?

Using a System Plug-in (.saver bundle) inside a Cocoa Application as a Resource

I'm new with Cocoa / Objective-C development and I have a question.
Last week I had to create a SWF based Screensaver for Mac, and as I didn't find a free-compatible solution for Mac OS X Snow Leopard / Lion, I created a .saver bundle with Xcode 4. It creates inside a webview and loads inside the SWF file.
You must place the SWF file inside the Resources folder inside the bundle to make it work with different SWFs.
And now, I'm trying to code a Cocoa Application to do it automatically.
It has a simple user interface so as the user can select a SWF file. Then the code makes a copy of my previously build .saver file (I have the path hardcoded), places inside it a copy of the SWF file, and saves it where the user indicates in a save panel.
And here comes my question. Now I have the path of the .saver file hardcoded, but I need to have it as a Resource inside my app. Would it be possible? How could I use/access it?
Thanks for your help and time!
Your application already has at least one resource, assuming you didn't delete the MainMenu nib. Add your .saver bundle to that build phase. In the app's code, get the URL to the screen-saver bundle the usual way.

Using MEF with exporting project that uses resources (xml) contained in the xap

I'm doing a proof of concept app in SL4 using MEF and as part of the app I am importing another xap from an existing Silverlight Project and displaying it in my host project.
The problem is that the existing app uses some .xml files (as content) and it uses linq2xml to load these files which are (assumed to be) bundled in the xap.
When I compose the application the initalization fails because the host app doesn't contain the xml files. If I copy these xml files into the host project and run it the composition works fine. However, I need to keep the xml files in the original project.
Is there a way that I can download a xap and look at it's contents for xml files and then load them into the host xap at runtime so that after the compostion takes place the xml resources that are required can be found?
Or should I work out some kind of contract with an import/export to pass the xml files to the host xap?
As the people developing the imported xaps (should the project go ahead) are from a different company, I would like to keep changes to the way they develop their apps to a minimum.
I assume you are using the DeploymentCatalog to download the second xap? Unfortunately there's no way to get at resources included in that xap. You could have the resources embedded in assemblies which are included in the xap, and then modify the way they are loaded.
If you really don't want to change the way the secondary xap is structured, you might be able to write your own DeploymentCatalog which would also allow you to load resources from the downloaded xap. The source code to DeploymentCatalog is available, so you could base it off of that.
I've managed to find a solution that I'm fairly happy with.
Instead of building the .xml files as 'content' to go within the xap, I have built them as 'resource' then used Application.ResourceStream() and loaded the xml using a stream.
It means the second xap developers will have to change the way they operate, but its only one extra line of code and changing the Build Action, I'm sure they can handle.