[TIMOB-14617] iOS 7 : Backgrounding Features

Introduces following new events

New Ti.App.iOS level Events

* backgroundfetch
* silentpush
* backgroundtransfer
* downloadprogress
* uploadprogress
* downloadcompleted
* sessioneventscompleted
* sessioncompleted

New Ti.App.iOS methods

* setMinimumBackgroundFetchInterval(fetchinterval);
* endBackgroundHandler(<sesionId from the Ti.App events>);


__TESTING INSTRUCTIONS__

** There are 3 cases to be tested for urlSession
Use the following [app.js](https://gist.github.com/srahim/7434503) for all cases mentioned below.
Be sure to include the module to your project.

__1. Foreground downloading__
     * User initiates a background download while in the foreground. The download completes while in the foreground itself.

 __Instructions.__ 
* Create a app with the above provided app.js.
* When the app starts click on the download button. and the image should download and the result would be stored in applicationdata directory. 
* The progress can be monitored on the console.
* Once the download is complete. the appropriate task will be removed from pending downloads and the downloaded file name will be added to the downloaded list.

__2. Foreground download initiation + Background download__
     * User initiates a background download while in the foreground. Then the app is but into background, download completes while the app is in the background itself.

 __Instructions.__ 
* Create a app with the above provided app.js.
* When the app starts click on the download button. and put the app into background by pressing on the home button on the device. 
* The image should download and  the result would be stored in applicationdata directory. 
* The progress can be monitored on the console.
* Once the download is complete. the appropriate task will be removed from pending downloads and the downloaded file name will be added to the downloaded list.

__3. Background Fetch causing a background download__
 ****NOTE ::  This would be the most important and slightly tricky use case as you would have to use Xcode to complete this.

* The app is launched due to a 'backgroundfetch' event which would trigger a background download.

__INSTRUCTIONS ON TESTING__

__initial test setup__
* Create a app with the above provided app.js.
* Include the following in your tiapp.xml
```
    <ios>
        <plist>
            <dict>
                <key>UIBackgroundModes</key>
                <array>
                    <string>fetch</string>
                </array>
            </dict>
        </plist>
        <min-ios-ver>7.0</min-ios-ver>
    </ios>
````

* Buiild the app for iOS Simulator. 
* Once the app launches kill the simulator and Studio process. 
* Navigate to the apps build folder and native xcode app (should be <project directory> /build/iphone/<projectname>.xcodeproj) 
* Open the build project in xcode. 
* On the top right corner, Click on the schemes drop down (make sure you have selected any iOS 7 simulator before continue)
![schemes drop down](https://f.cloud.github.com/assets/847863/1524029/ef18f486-4bbf-11e3-8194-b972f60ad893.png)
* Click on Manage schemes from the drop down
![manage schemes](https://f.cloud.github.com/assets/847863/1524075/b1513d92-4bc0-11e3-8047-a86469217cf7.png)
* which would bring you to this screen.
![schemes window](https://f.cloud.github.com/assets/847863/1524081/c878051e-4bc0-11e3-9a69-7504fb55734a.png)
* Select one of the schemes (say: <appname>-universal)
![selecting the universal scheme](https://f.cloud.github.com/assets/847863/1524087/df73111e-4bc0-11e3-9afd-0f7255064fb3.png)
* Click on the little gear at the left hand bottom corner of that the window to reveal another drop down menue.
![Duplicate scheme](https://f.cloud.github.com/assets/847863/1524100/21af73c4-4bc1-11e3-8ce6-0188481fc588.png)
* Select duplicate option
* On the new window that pops on top of the previous window Enter a new for the scheme and __select the launch due to a background fetch event option.
![screen shot 2013-11-12 at 11 11 46 pm](https://f.cloud.github.com/assets/847863/1524147/9c6829b2-4bc1-11e3-86c2-9ae1b1121244.png)
![actions](https://f.cloud.github.com/assets/847863/1524205/c28d1912-4bc2-11e3-9581-d6689f6b2938.png)
* Hit OK
* HIt OK 
* Now you should have a new scheme, which is automatically selected for you. 

__actual test__
* Click on the play/run button to build and launch the app into background. 
* Look at the console log to verify that a backgroundfetch event was fired.
* Soon after the backgroundfetch event is fired backgroundtransfer event would fire indicating that the download relaunched the into background.
* the rest of the of downloading events would fire short after. 
* Once the initial download is complete if you want to test again. 
* In the xcode menu bar select `Debug` Option. 
* Under Debug Option Select the `Simulate Background Fetch` option.
![debug-simulate background fetch](https://f.cloud.github.com/assets/847863/1524244/5263ea98-4bc3-11e3-92f6-bdba5886b048.png)
* This would trigger another backgroundfetch. 

Please do let me know if you get stuck on any of the steps.