iOS directories, that are writable at Compile- and Runtime - ios

I'm programming with a deployment target of iOS5.
Is there some directory, which i can put in some static files in at compile time and write to that same directory a runtime?
IMHO the home directory is not writable at runtime. (sandboxing?) At the moment for my runtime writes i use NSTemporaryDirectory(), which is not accessible at compile time..
Help is much appreciated.

The answer is no. You put files in your bundle, and later you can copy them to another folder. I believe (but have not tested) that you can also create a link to them if they are large and you don't want to create two files. If you do this you need to think about what happens when you update the app.

Related

How to access .dll or .so files in an android project Xamarin

I have a folder with a lot of .so files which I'm trying to use while my code is running.
I place them in a folder called "External" and then I try to access them like this:
[DllImport("External\\libvocon_ext_heap.so", EntryPoint = "ph_CreateWin32PrivateHeap", CallingConvention = CallingConvention.Cdecl)]
public static extern PH_ERROR ph_CreateWin32PrivateHeap(ref LH_HEAP_INTERFACE pHeapInterface, out IntPtr ppHeapInst);
I've also tried to place the files in the Assets folder, but i still get the same System.DllNotFoundException
This is a late answer but I did find the solution to my problem. The main issue was how I stored the library files in the project. In order to locate the library files they have to be stored under specific directories. Instead of storing them in the "External" directory as I did, they must be stored in a directory with the name "libs" and a specific subdirectory like the following:
libs>armeabi>libfoo.so
libs>armeabi-v7a>libfoo.so
libs>x86>libfoo.so
Because Android CPUs can be based on 3 different ARM architecture, there has to be a directory for each of those architectures (armeabi, armeabi-v7a, x86). I imported the library files like this:
[DllImport("libvocon_ext_heap.so", EntryPoint = "ph_CreateWin32PrivateHeap", CallingConvention = CallingConvention.Cdecl)]
You only need to write the name of the library file since it will locate the right directory path by itself. You can also write the name like "vocon_ext_heap" since it can automatically add the "lib" and ".so" to the file name if it is missing.
I also re-installed the Xamarin SDK manager because I found a possible solution asking to re-install it, but I don't know if it fixed anything related to this problem. Also, the libraries of course has to be build as AndroidNativeLibrary as Softlion mentioned.
Have you set the build action of your so file to AndroidNativeLibrary ?
See https://developer.xamarin.com/guides/android/advanced_topics/using_native_libraries/

Are these files needed inside the .app file? (swift)

I'm very new to xCode (or compiled code in general) and I was wondering when I was looking through the .app file if all these were needed.
For every of my classes there is a .o; .d; .swiftdeps; ~partial.swiftdoc; ~partial.swiftmodule file.
Some of these files also contain my working directories...
In the Build Phases of my app I added all my classes to Copy Bunde Resources (otherwise I would get a compile error), maybe that is the reason or are all these files just necessary?
Because when I was looking through over apps I did not find any of these kind of files.
Thank you for your help. :)

How can I arrange my project files according to their folder structure in Xcode

I am working on a MASSIVE project with about 10 thousand files in it. The files are nicely arranged in Xcode's directory system but not so on the disk. Is there a tool that I could use that would make the folder structure on my disk represent the folder structure in Xcode?
Personally, I know two ways to do it:
Do it manually (rearrange your folder first, and then drag and drop your directories in xcode). That will do the job.
Use an external library, I suggest you synx. It does the job well
I don't know why you want to do that, but I don't think it's really important if your folder isn't ordering with your xcodeproj since you will always open it with xcode. Just separate assets is enough, isn't it?

How to add large number of static files to MonoTouch bundle?

I have (quite a bit of) static files that I need to deploy with my application that is built on top of a legacy .NET library. These include several XML and config files, and a read-only database in the 10's of Megabytes.
Most forums I have seen indicate that the best way to accomplish this is to reference the needed files in a project, and set them to Content and "Copy to Output Directory".
I have two issues/questions dealing with this:
Adding these files, and setting them to "Content" seems to not only copy the files over, but embed them into the .dll as well. In other words, I have 40 MB worth of files, and a 40MB dll (this project's only goal is to import these files, there is no substantial code).
How can I prevent this extremely large dll from being made?
Is there an alternative way to get files into the App bundle? I would love to use a custom build command, and although I can copy files into the target directory ${AppDirectory}, but this does not result in these files ending up in the app bundle. Is this approach possible?
Any help is appreciated in advance.
You need to include your files from the main .exe project. You do this by using MonoDevelop's Build Action to Content on each file. They should be copied to the .app without being included inside an .dll (or the .exe).
An alternative (for development) is to use iTunes sharing to copy once your files to your device. This allows you much faster deployment times while developing.
Of course you can't submit such build to the app store (unless the files are not required to make the application work, unlikely). What I do (for my nearly 80MB read-only database) is to use this hack (loading from /Documents) inside #if DEBUG. The release build load the files from the normal location.
I have not automated the process (still debugging the app ;-) but it should be possible to script this so modifying the project options (for each file) is not required when switching from Debug and Release builds.

What is the best way for packing 6000+ sound files in a iOS Application

I'm working on a iOS application that will contain around ~6000 mp3 of sounds files.
Each one is around 1 second (2 max) long and rather low quality (24K bitrate) weighting in at around 2-3KB each. (Please do not comment on the quality, it's as it should be)
Since this is a large amount of files I was wondering what we be the best approach for packing these into the bundle? Should I just throw them together in a group? Is there someway of storing them in a single "package" file then reading them out separately as needed?
Also, what would be the best place to place them: Library/ ? Documents/?
As I'm rather new to iOS development and kick in the right direction will be greatly appreciated.
Thanks in advance,
Ken.
You can create a bundle which will contain all your mp3 files. Your files will be in the ressources of your application, no need to store them in the Documents or Library path of your application sandbox.
The way to create and access a bundle is illustrated here.
Hope this helps
There is no package type that were meant for resource files. There are ones for static and dynamic libraries, custom frameworks and so on, but purely for resources I know of none.
Instead of adding them in bulk into a Group in Xcode's project hierarchy, you should add the containing folder as a folder reference to the project. (Appears in the file navigator in blue.) This way any external modifications you make to the contents of the folder, like adding/removing files will automatically be picked up when you next compile your project.
You can do this by dragging the folder from within Finder to the project browser in Xcode and when asked choose "Create folder references for any added folders".

Resources