Is there a maximum size to NSDocumentsDirectory? Are the contents accessible outside the app? - iphone

Is there a limit to the amount of data that we can put to the NSDocumentsDirectory? My application allows photo and video capturing and I am saving this data to the NSDocumentsDirectory. Can I keep on adding images and videos to the app then? Also, are these images and videos accessible outside the app? Can we delete them using iTunes? Help please!

You should start with reading apples programming guide for file system access.
And remember: Whenever something in the apple docs reads like a hint or a recommendation, it actually says "do it that way or we won't let your app into our store".

Related

xcode move audio files

I am creating iPhone application using PhoneGap. In that I have used navigator.captureAudio method to record the audio. Normally the recorded audio files stored inside the Application(tmp folder). So the application size getting increase each time while recording. I don't want to keep the recorded file inside my application.
Is there any way to move this file from application storage to outside(like music)? How to move this files in Xcode? Any suggestion on this?
Thanks
AFAIK any files your application will create must be stored within the Application directory structure. This is because each iOS app operates within its own sandbox.
See Apple's docs on this: File System Programming Guide.
You can interact with other applications such as the music app using MPMusicPlayerController, but I've never tried adding files to this, only playing files.
You could always experiment with iCloud integration? Although this will still appear in your sandbox I think.

creating iphone app for existing site. need advice about the data I'm downloading

I'm building an iPhone app for existing site (a local news site)
Main page with articles headers, when click on them you move to the article page. Simple.
This is the first time I'm building such type of app.
I have 3 general questions, just to make sure :
For the iphone, Do we need to
re-create the website article's
pictures for the iphone ? or there
is some programming tool that on the
fly make the files looks better on
the iphone ? or maybe, there is some
technique that creates one artice
picture that looks right both for
the server and the iphone ?
Usually, Do you need to create
special data channels from the
iPhone webservice ? or programmers
just use the existing rss channels
of the webserver ?
If someone know nice artice about
this stuff, It will help a lot. just
see what other are doing.
thanks.
You can see the intent Media apps, these apps are working like what you want your app to.
1) You're better off creating mobile versions of the images. You can do image processing on the iPhone, but you'll have to have the original and that makes the whole thing pointless (ie. you have to download the whole thing.) Generate a mobile thumbnail when those are uploaded on the server.
2) RSS will do. There's a very good tutorial at cocoadevblog.com about approaching such a task (I guess this covers 75% of the work you have to do)
3) Check 2) ;-)
if your download image is bigger the the thumbnail you are trying to display,
then the problem is in your code that change the image size. check carefully what are you doing to the image after downloading it.
I would recommend to create square thumbnails of your pictures at the server level. This will allow you to easily position in the iPhone screen, plus you will not need to download the whole image from the server.
nnahum

Access iPhone User Songs and Videos?

I was wondering if I can access user's songs and videos in iPhone, part of that access if I can save them or modify them? hopefully not a Jailbroken iPhones
I am greatly appreciated.
Yes, you can. I can't speak for video, because I've only done it for audio, but you can definitely get audio data. These links should get you started. Note: I am as yet unsure if this works with tracks that use any kind of iTunes-related DRM.
First of all, this blog post talks you through the method of accessing the data. Note the reliance on iOS 4.1 or above.
This SO question/answer explains how to get at the raw pcm data, should you want to do more than just save it out.
You can allow the user to pick songs using the MPMediaPickerController class. I think you can save the selected item to your app's sandbox directory.
You can read up on this a bit more with this SO question.

Play specific local IPhone Video

I am in need for some help as I am stuck with a problem with my current IPhone application. I won't go into every details but the mainline is as follow:
I am currently playing videos from a remote URL. Everthing up to this point is working. But we need to add a certain validation as if the video exists on the local IPhone, play this version and otherwise, get the remote version. I get these informations from an XML feed and have the name of the video and it's remote URL.
I've implemented the ALAssetLibrary as a way to retrieve the locals video and transfered 3-4 videos with custom names. After some struggling, I could play these local video. But while I loop through them, all I get is names like 00001.jpg, etc.
Is there any way to get a local video name ? I don't mind if this needs another library but I would appreciate if someone could point me a way of doing it.
Thanks for your time,
AP
You don't have access to the local filenames, and even if you did those filenames would probably not be what you are expecting (i.e. Apple can and probably does rename them while saving them to the Camera Roll).
You can check the metadata on the ALAssetRepresentation for the video to see if a suitable name or other identifier can be found in there. You might also be able to retrieve the raw data and hash it, but that would fail if Apple does any recoding or metadata alteration when saving the video. If your program itself downloads and saves the videos to the Camera Roll using writeVideoAtPathToSavedPhotosAlbum:completionBlock:, you could store the returned assetURL to remember the correspondence. Or you could save the videos to your app's local storage instead of to the Camera Roll, but that would prevent the user from managing the videos with Apple's photo application and such.

Save audio file from app to iPad/iPhone library

I have been trying to figure out how to do this for most of the day, but I haven't been able to find much help. We have this multimedia app that allows users to view pictures, videos, and music/ringtones about the particular subject. I know you can save images using UIImageWriteToSavedPhotosAlbum and you can save a video file using UISaveVideoAtPathToSavedPhotosAlbum. But I can't figure out how to allow the user to save an audio file. All the files are stored within the app, so its not like I'm trying to stream or download them from the internet. Does anyone have any pointers on how to do this?
The official SDK only allows you to retrieve information with MPMediaLibrary, no write access.