I need to record video and upload them to Server. They will be added in queue and uploaded one by one.
My question is, when i record a video, where should i save it till it gets uploaded ?
Should i save it in Album ? or in private documents directory ?
I also need to delete the video once it is uploaded.
According to ios guidelines, is it required to save the video in Albums only ? Will my app be rejected if it is saved in Documents directory for longer period?
If they are not user-created (or if you do not want them to participate in stuff like iCloud), then do not put them in APPHOME/Documents.
The preferred location is APPHOME/Library/Caches but that location can get cleaned by the iOS on a system restore (and possibly other times -- documentation does not specify). It's not going to happen on a regular basis though, so it's the first option if you can regenerate the data on rare occasions like restore.
So, if the files can be recreated, keep them in APPHOME/Library/Caches. If they cannot, then place them somewhere else in APPHOME/Library.
Just make sure you remove them when you are done with the upload.
You're ok, you can save/delete them in/from the Documents directory. Instead, you can't delete videos/photos from the user's albums. No problem for the "longer period".
Related
I have a question on metadata on video files.. Can metadata tracks the last user who download a video file from sources with the relevant date and time information?
Say if a video was downloaded to my local computer... Subsequently it was copied to another hdd and computer.. Can metadata tells or track the last user of this video files?
If yes how was it done and how to find the info? I know words or excel does track the original author and subsequent user who saved and modified the doc.
Many thanks.
The basic answer is no, you cannot track the last user of a video file by the metadata. There's no OS mechanism to insert this data as it gets copied or moved from computer to computer.
Oh ok. So within the video file itself we cannot tell the last source used and also the origin? I was trying to find out some clue that may presence , ie who last use it and downloaded it
I'm trying to limit the space used by my iOS app and thus delete old pictures if a limit is reached. However old picture doesn't mean unused picture. I was wondering if there's a way to know if a picture is being used or has been loaded recently to avoid deleting it and thus avoid provoking an app crash. I'm using NSFileManager removeItemAtPath. Thanks!
Any one has more info than the doc on NSFileBusy ?
You can get the fileModificationDate from the files attributes, and thus can decide to remove it..
In this case you must take care of the files user has kept for future use. Like the wedding photos and childhood photos which we hardly see daily, so they are not modified recently, make sure your code does not delete them without user's permission.
I have developed one app in which, monthly magazine issues are downloaded and stored inside the app Document directory.
But app have rejected app due to storing of magazine issue in document directory. My magazine file size is around 50 MB.
They mentioned below:
The iOS Data Storage Guidelines indicate that only content that the user creates using your app, e.g., documents, new files, edits, etc., may be stored in the /Documents directory - and backed up by iCloud.
Temporary files used by your app should only be stored in the /tmp directory; please remember to delete the files stored in this location when the user exits the app.
Data that can be recreated but must persist for proper functioning of your app - or because customers expect it to be available for offline use - should be marked with the "do not back up" attribute. For NSURL objects, add the NSURLIsExcludedFromBackupKey attribute to prevent the corresponding file from being backed up. For CFURLRef objects, use the corresponding kCFURLIsExcludedFromBackupKey attribute.
Any help appreciate.
Thanks.
Move your files to the Caches directory and you should be good to go.
I believe that if it is user generated content, there is no problem with storing it on the /Documents folder.
Since it is content that can be downloaded again, you have to set the NSURLIsExcludedFromBackupKey file attribute which prevents it from being backed up to iCloud.
Take a look at this question on setting the attribute: Use NSURLIsExcludedFromBackupKey without crashing on iOS 5.0
I can able to move a file from the local directory to iCloud using the condition setUbiquitous:YES. The file has been moved successfully. If the file size is large, it takes certain time to complete moving. Is there any method to identify, if the file has completed moving to iCloud? Thanks in advance for your answers.
Note: I haven't done this myself, so all the info below is purely from reading the documentation:
The NSMetadataItem class has, among others, an attribute key called NSMetadataUbiquitousItemIsUploadedKey. Knowing this, you should be able to set up an NSMetadataQuery that notifies you once the item has been uploaded.
You can check with NSUURL getResourceValue:forKey:error: method
NSURLUbiquitousItemIsUploadedKey—Indicates that locally made changes were successfully uploaded to the iCloud server.
NSURLUbiquitousItemIsUploadingKey—Indicates that locally made changes are being uploaded to the iCloud server now.
NSURLUbiquitousItemPercentUploadedKey—For an item being uploaded, indicates what percentage of the changes have already been uploaded to the server.
For details: https://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/iCloud/iCloud.html#//apple_ref/doc/uid/TP40007072-CH5-SW1
I want to save some images from my server to the iPhone app temporarily.
It is one of my application's purposes to, when the user closes the app, delete the saved images.
Again, when the user starts my application and taps on the corresponding button again, I need to save the data. I don't know how to start it, I know only we can do this with the help of NSFileManager.
Please can anyone guide me on how to start or write the code.. Thanks in Advance :)
Store the files in either the tmp or Library/Caches folder. In neither case will the files be automatically deleted, but they won't be backed up and so don't contribute permanently to the app's storage requirements. If you also want to delete the files on close, do it in -applicationWillTerminate.