Best practises for uploading video in ios app - ios

I'm developing an ios application.
As part of my application I need to support upload of a small sized video created by the user (20 mb).
What would be the best way to approach the uploading? Should I handle it with a queue? Are there any built in libraries that support it?
Thanks

That depends on the version of iOS you are planning to deploy on. As of iOS 7, the NSURLSession class provide mechanisms to allow you to finish larger file transfers in background and pause them.
Follow the next links for more information:
https://developer.apple.com/library/mac/documentation/cocoa/conceptual/urlloadingsystem/Articles/UsingNSURLSession.html
https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSURLSession_class/Introduction/Introduction.html
http://www.raywenderlich.com/51127/nsurlsession-tutorial
AFNetworking also provides very easy to use API around NSURLSession and it even supports older iOS versions (not their entire API though).
There is also some information in questions below:
How to work with large file uploads in ios?
AFNetworking + big download files + resume downloads
How to Transfer Large Files over wifi in iOS
If iOS7 support is enough for you, I would suggest using AFNetworking 2.0 library and following their best practices described in their extensive documentation at CocoaDocs.
If you do not want to use a library, go with Apple's built in class NSURLSession.

There is a library called AFNetworking.AFNetworking
Learning how to implement look here
Here are some examples

Related

Making a shareit clone ios

I am making an app that involves sending and receiving files from one iPhone to several other iPhones. I did a lot of googling and came nowhere in finding the classes that support the above said features. I am wondering whether it is possible and if it is possible what are the classes that i can use to do that
Take a look at my library https://github.com/abdullahselek/Merhaba
you can send data with Bonjour networking

Multithreading in adobe air ios?

Hi i am developing an application using adobe air for iOS using flex.
i have the user take a snapshot and my intention is to upload the photo to my api.
the problem is when compressing the byteArray and then encoding it to a base64 String to send it up the apps freezes for 1-2 minutes.
My question is: is there a way to multithread this process in adove air, so i have it going in the background ?
and from your experience does an adobe native extension use another thread on the device for itself or no, maybe i can handle the background encoding and upload in a native extension.
Thank you all.
AS3, up until recently, was entirely single threaded. As of FP11.4 and AIR 3.4, you have access to Workers, which is essentially offloading tasks to a second thread. Beta support was added to Android in 3.8 or 3.9 and I believe it is out of beta now in 13.0. Workers are not supported by iOS, though. This is, I believe, because they have to cross compile to Objective-C to support iOS at all, so their methods won't work.
You're only option is to load the processing onto an ANE, which may or may not be a good idea. ANEs are meant to behave as a bridge between AIR and native OS APIs. While this would work, I think it goes beyond the scope of what an ANE is intended for.
Unless your photos are insanely large, I would suggest just not doing compression. Resizing photos (using the BitmapData class) is fairly quick on 4S+, so I don't think that is much of an issue (4S is closing in on being 3 years old at this point. Having old hardware means things run less than ideally, so anything older will just have to accept poorer performance)
Worker Documentation

Concurrency via Native Extensions on iOS

Currently, the AIR beta (3.9) allows concurrency on Android but does not provide it for iOS
To solve this problem, or maybe even to do it more efficiently than AIR workers when they become available on iOS, is it possible to do concurrency via a native extension (ANE)?
I see the section "Threading" at http://www.adobe.com/devnet/air/articles/extending-air.html but it only leaves me a little more educated at my guessing :)
Let's consider an MP3 Player with visualization. Can an app be built such that the native extension reads the MP3 data, processes it, and hands over both the raw sound data and computed visualization for the actionscript layer to then play/display (and possibly manipulate the display further)?
I definitely think this is a legitimate usage of native extensions. We use threading in a few of the ones we've developed. It's a complex area to create a quick tutorial though but basically the iOS documentation on NSThread is what you should be looking into.
There's a good rundown on the concepts and some sample code here:
https://developer.apple.com/library/ios/DOCUMENTATION/Cocoa/Conceptual/Multithreading/CreatingThreads/CreatingThreads.html
The major difference between this and the AIR concurrency is that the concurrency code is written in AS3 whereas with the native extension you'll have to write in native code for every platform you develop on.

Can web app for ios run as smoothly as native?

Is there a framework that will allow to create web apps for iOS that will run as smoothly as native app?
I've checked demos of Sencha Touch http://www.sencha.com/products/touch on my iPad there's visible delay for touch events and for how precisely they are recognized. The feeling isn't the same as for native apps.
Is there other frameworks or technics that will allow to provide same experience as native apps?
It depends on your app. If your app is a hard-core heavy-duty 3D game, then no. If your app is primarily displaying static content ... like a web page or collection of photos, you might get close enough.
Think about what experience you want to achieve first. If you want a cross platform application and you want to avoid the stores (App Store, Google Play, BB App World), then by all means, consider a web app.
Other things to consider, how much data do you estimate the user will need store locally (HTML apps are more limited in this respect); how much functionality is lost when there is no network connection, and does this loss of functionality make the app unusable.
Like the answer by #RichardTurner, if you need the kind of performance you find in the higher end games (Infinity Blade or Modern Combat 3), then native is the way to go.
Figure what you want, then you will have better idea of what technology to use.
NO. Native apps will perform better every single time over web apps. If you want a smooth experience, go native. Also consider that some people have older model iOS devices and performance will be even more difficult to achieve on those devices in web apps.
Here are a few things to consider with a Sencha app vs a native application.
You were browsing a Sencha Touch application online and chances are it wasn't a "packaged" version so you would have to download each source file individually.
With Sencha, you can utilize Sencha CMD to package an application which essentially builds a single minified js file containing only the required components from the Sencha library and your application (smaller DOM). You can also look into a production version which takes advantage of appcache. You'll see some performance increases here.
A packaged native Touch application will contain the actual JS, CSS, etc. files as part of the applications source, so their is no downloading from external resources.
You have to consider that any HTML5 application is going to have a ~300ms touch delay, more on that here: http://updates.html5rocks.com/2013/12/300ms-tap-delay-gone-away

Direct access to iPad Photo library

I understand that it's possible to access the iPad Photo library using the UIImagePickerController. The problem with this is that it makes it possible to access only one image at a time. I'm building an app that needs to be able to select multiple images from this library simultaneously (without loading them into memory) to save for further manipulation. This would require obtaining the file paths.
I've read that it's possible to access the Photos file system using the photolibrary.framework. This is a private API though, which would presumably disqualify the app from the App Store.
There are apps in the store that apparently have this capability though. Are they braking Apple's rules or have they found a "legal" way around them?
I've also heard that iOS 4.2 (coming this November) is supposed to make direct access straightforward.
Anyone know of a legal way to access the Photos file system using the current iPad OS?
Thanks,
Paul
There is no API currently available to support that functionality
Have a look at this project on github: https://github.com/elc/ELCImagePickerController
It generally is an ImagePicker that allows to select multiple images at once. Therefore, it needs to read the iOS Photo Library. So looking at the code you should be able to figure out how to do it.

Resources