I have studied the background syncing and multitasking capabilities of iOS 7. What cant figure out is the possibility to upload new photo's taken with the camera app.
The part to upload a file in the background isnt the hardest part, but what delegates do i have to use to detect wether a photo is taken and upload this particular latest photo?
Possible duplicate: iOS - Background uploading of photos
I think you can use Photos Framework to do it. There is a delegate method to callback if one photo is edited or added.
First Photos Framework only supports iOS8+;
#import Photos;
Implement PHPhotoLibraryChangeObserver protocol;
- (void)photoLibraryDidChange:(PHChange *)changeInstance {
if (![collectionChanges hasIncrementalChanges] || [collectionChanges hasMoves]) {} else {}
}
If I understand correctly, what you want to do just cannot be done on iOS (Apple security limitations).
If you want to upload a photo each time user takes a photo with Camera app (the OS built in Camera app), you would have to implement something such as folder scanning, to detect there is a new image in Photos folder. That would require access to complete file system, including files of all applications, which cannot be done due to Sandbox restriction.
In iOS, each application has it's own directory and you are allowed to write only to that directory. Access to files outside of it is always rejected (unless you are super user on a jailbroken phone).
Read more about iOS Sandbox:
https://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/TheiOSEnvironment/TheiOSEnvironment.html
https://developer.apple.com/library/mac/documentation/security/conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html
What is Sandbox in ios , Can i Trans data between in one App to Another App in iPhone,if possible how
So what you can do on iOS, is to open a Camera picker view and allow the user to take a photo. After that you can easily access the photo and upload it to your server. Read more about it on the links below:
opening camera in iphone app programatically
https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/CameraAndPhotoLib_TopicsForIOS/Articles/TakingPicturesAndMovies.html
Related
currently in my app I'm fetching the images from Photos app and showing them in my app.
in my app when user click the image
I want to open Photos app with selected image ,is there any way to do this?
You can't do that.
Also, There is not officially documented way to open Photos App as well.
You might, still open the Photos application using photos-redirect:// url scheme but this is also not documented by Apple to use so you might face some problems with it during the review process.
Opening to certain pre-selected photo in the Photos application is not possible.
I am using the UIImagePickerController to take Images and videos for the App.
What i need to ensure is the app takes minimum storage. So as soon as i have taken the image/video i upload it to my server so that i can access it using a url now.
Thus what i need is whenever the app terminates , i want to clear all the images and videos taken , so as to ensure less memory is consumed.
Please note that i do not want to delete the file immediately after uploading. I know how to delete a file from a directory individually.
Kindly suggest some other approach if I am wrong.
no guarantee that applicationWillTerminate will ever get called may that is the reason you can not do that (Thus what i need is whenever the app terminates , i want to clear all the images and videos taken , so as to ensure less memory is consumed.) . so if your need to do anything before app exist then call applicationDidEnterBackground
but you can try on trick for that
Local notification on application termination
Update :
How to save images from Camera to specific folder in iPhone gallery?
and
Delete files in iOS directory using Swift
How to delete ALL FILES in a specified directory on the app?
If user changes the photo while my app is transferring it to a remote device, will the remote receive a corrupted photo? In iOS, is there a way to "lock" a photo using Photos Framework so that it cannot be modified by other app?
The remote won't receive a corrupted because the edit will not affect the file that you are uploading.
I don't think there is a way to "lock" a photo with Photo Framework.
I hope it helps!
Good luck
I'm using Adobe Air for an iOS8 app and I would like to load the latest added image of the Photos app.
I was thinking about using the CameraRoll API but would that work without a direct user interaction through browseForImage?
It is possible to receive the last photo with the help of a native code:
How to retrieve the most recent photo from Camera Roll on iOS? .
You can write Adobe Native Extansion(ANE) to transfer the last photo from a native code to ActionScript.
Instructions for creating ANE:
http://gamespoweredby.com/blog/2014/12/developing-adobe-air-native-extensions-for-ios-tutorial-1-en/
It's possible to do this using UIKit in a native iOS app, but AIR doesn't provide a method to select items from the camera roll without user interaction.
I am using Xamarin to develop an IOS app. Here the user has an option to download audio files to the document folder within the app, and play it later on.
But i would like to provide an option for the user to access it in music folder or somewhere else, so that user does not have to come back to app to listen it.
Like we save images to camera roll, can we save mp3 or any other audio file to default music folder in IOS. Any solution or ideas using xamarin or xcode are welcome.
Note: I already know about File Sharing with itunes, i am looking for something else explained above.
As I know this isn't possible due to the limitations within iOS