On my work, technology and related stuff....

About me

Hi, I am Priya Rajagopal- a technologist, software architect and developer. I have worked on a wide range of technologies in my career. My current passion is mobile development. The notion of a customizable and powerful computing platform in the palm of your hand (literally) is very exciting.
Read more..

multiple iOS sim

2 comments

Today, I gave an introductory level technical talk about developing mobile apps for iOS platform at the American Society Of Engineers Of Indian Origin (ASEI), MI. The ASEI is "a two level (National and Local) non-profit organization of engineers and technical professionals of Indian origin". You can learn about them at http://www.aseimi.org. I was aware of the group but I had never attended any of their meetings, so  I was not sure what to expect.

Right after work, I made the 45 mile drive to the ASEI meeting. Fighting the evening rush hour traffic, I reached there on the nick of time ; I probably made the organizers quite nervous!

There was a pretty good turn out. These were people, who just like me, had driven in from work and who probably had ten other places they'd rather be on a fall evening with picture perfect weather. I had to ensure that my talk was well worth their evening.

Soon after the featured mobile app presentation, I got started. I surveyed the room and learnt that there were less than five developers in the room. The rest of the audience was a mix of people with diverse backgrounds (different industries , different roles, varying demographics, a few were not even iPhone users). 

My presentation was intended to be fairly technical , so my challenge was to make it appeal to the diverse audience. Although they were all not developers, I knew they all had one thing in common – they were very keen on learning more about iOS mobile development. I knew that was a start.

So for the next hour or so, I quickly moved through my slides. I had material for couple of hours but I tried to focus on material that would broadly appeal.  Then the questions started pouring in and they were all very relevant. People were paying attention (well- at least most of them were) and it was interesting to see different perspectives. 

I left the meeting with a greater sense of community. 

You can download my presentation from here. It is intended to be a primer to the iOS platform and developing apps for it .

1 comment

This post describes a way to scale the text content that is presented within a UIWebview of your iOS app. Often times, there is a need to zoom in or zoom out the text content presented within UIWebview container in response to user actions. •   Run a simple Javascript on the contents of the webview using the stringByEvaluatingJavaScriptFromString method in order to adjust the size of the text.
 

In the JS above, DEFAULTWEBVIEWFONTSIZE refers to the default font size of the text content presented within the web view and updatedFontSize refers to the desired font size. So for example, if DEFAULTWEBVIEWFONTSIZE is 18 and updatedFontSize is 9, then updatedFontSize*100/DEFAULTWEBVIEWFONTSIZE evaluates to 50.

 

•   Next step is to adjust the frame height of the web view so the scaled text content is visible. The simplest way to do this is to have the UIWebView as a subview of a scrollable view (UIScrollView or  its subclass ).  That way, you can adjust the web view frame height  and correspondingly, the content size of the scroll view that encompasses it. Adjusting the  web view height is a bit tricky as described below.

 

The sizeThatFits method on web view returns a size that best fits the content. The problem with this is that when you scale up, the method returns the updated size but if the web view is large enough to display the specified content, then scaling down will not update the frame size but instead, the current frame size is returned.

 

So first , reset the current frame height  of the web view to a small value like 1.

 

Now, obtain the frame size that would best fit the content. Since the current frame size is 1, we are scaling up. Update the frame size of the web view with the new frame size.

 

Finally, update the content size of the UIScrollView containing the web view to accommodate the scaled content.

 

You can download a sample project that scales the text content of web view from  here. Shown below are some screenshots of the app.

   

No comments

As an iOS developer (or any developer for that matter), it is not uncommon (or dare I say- its “very common”) for us to defer things while coding so as to not disrupt the current coding flow. For instance, handling of a special case or updating an algorithm with a more efficient one or just a reminder to double check a certain logic . To remind ourselves, we typically include a comment like “ToDo: Handle error code -1020” in our code.

 

Now, before we realize it, we have several “ToDos” and “FixMe” scattered throughout our project and unfortunately, many of them go unattended . Note that “attending” to them may be as simple as removing the comment because we have in fact handled the “To Do” but have just forgotten to remove the now obsolete comment which leads to clutter and confusing code.

 
 

So here is a neat little perl script that I found (and tweaked a wee bit for my purpose) that solves the problem. The script is executed  every time my project is built. The purpose of script is simple. The script greps for keywords in all the .h and .m files in the  ${SRCROOT} folder and prefixes it with a “warning”  label.

 

Now, every time, I compile my project, the script runs and displays all statements that begin with keywords listed in the KEYWORDS reg expression show up as warnings. They are now hard to miss and I can ensure that all the “To Do”s are handled in a timely manner.

To add the script, select “Add Build Phase” under the “Build Phases” tab of Xcode project settings.

 

Then , cut and paste the script to the “Run Script” section


Now, when you build your app, you should see all comments that include the keywords mentioned in the script listed as warnings.

No comments

The Problem…

If you have been using Xcode  (the latest version as of writing this post is Xcode 4.6.2 ) for an extended period of time, testing your app on the iOS simulator, you may eventually encounter a “Resource temporarily Unavailable” build error . There are no build errors associated with your source code but the system is unable to successfully build your app and launch the simulator to run it . You would observe something like this in your build output.

 

 

So what’s going on?

The reason this occurs is because every time you launch the iOS simulator through Xcode to run your app and then quit /stop running the app, Xcode leaves behind a Zombie process.  If you are not familiar with Zombie processes in Unix, essentially, it is a process that has completed execution but whose entry remains in the process table. It is the responsibility of the parent process to eventually clear these processes. The zombies don’t use any of the computer resources so you won’t observe a depletion of resources , but the problem is that in this “undead” state, they hold on the PID or Process Identifier. The implication of this is that eventually, your system will run out of PIDs to assign to new processes, thereby resulting in a failure to spawn or launch a new process.

You can confirm this behavior by running your iOS app through Xcode a few times and then running the “ps” command on the terminal window. You will observe a bunch of zombie processes listed for your app. The “Z” in the “S” (or “STAT” ) column indicates that “symbolic state” of the process is a “Zombie“.

In my case, there were 272 zombie processes associated with my app that Xcode didn’t reclaim. So in case of the Xcode, you will eventually notice that you are no longer able to build the app and launch the simulator to run it. In fact, you probably won’t be able to launch  any new application. Yep- not a good place to be.

So what are your options?

Reboot:

The simplest and safest method is to reboot your system. This will get rid of the zombie processes

Re-initializing/Killing the Parent Process:

Generally , killing the  parent process corresponding to the Zombie processes should take care of it but unfortunately, in the case of Xcode, the parent process is the system launchd process. The launchd is a core system process that handles the launching of many of the other processes.  Issuing a “kill” command to the launchd process can result in undesirable results and can even make your system unresponsive. So DO NOT kill the launchd process. You could try to re-initialize the process using the kill with HUP (“Hang Up”) option but you are probably better off rebooting your Mac.

If you are curious, you can follow the steps below to determine the parent process of the Zombie Xcode process

1) You can identify the PID  (“ppid”) of the parent process corresponding to the zombie process using the command

This will output the ppid of the parent process corresponding to the Zombie process,

2) You can get details of the parent process using the following command

The output of the above command indicates that the launchd process is parent process.

You can find more details on Zombie processes at you can check out  the details in http://en.wikipedia.org/wiki/Zombie_process.

32 comments

This post describes how to invoke a SOAP based web service from your iOS app. The post is not going to dwell into the discussion of SOAP based versus a RESTful service and neither is it intended to be a tutorial on SOAP. For more information on the latter,there are plenty of online resources including the W3C (http://www.w3.org/TR/soap/). This post assumes that your needs require invocation of SOAP based web services from your iOS app.

We will use a free online web service http://www.webservicex.net/CurrencyConvertor.asmx?WSDL for our example. This is a very simple web service handles currency conversions (surprise!).

I recommend a free utility called "wsdl2objc" which generates client-side Objective-C code from a SOAP Web Services Definition File (WSDL) file. You can always construct the SOAP request messages and parse the SOAP responses on your own without the tool, however, the tool does a lot of the heavy lifting and is convenient.

1. Download the wsdl2objc tool from http://code.google.com/p/wsdl2objc/

2. Run the wsdl2objc tool . Enter the source URL for the WSDL and the destination folder for the generated ObjC files and select "Parse WSDL" button. A screenshot of the same is shown below

3. Once the "Parse WSDL" process completes, you should see a number of ObjC files in the destination folder.

4. Follow the following steps to integrate the ObjC files into your app.
4a) Copy the ObjC files that were generated in the previous step to your app project. Make sure you select the "Copy Files Into Destination Folder" option.
Description: Macintosh HD 2 Mountain Lion:Users:mactester:Downloads:post:screenshot-copyfiles.png

4b) If you are using ARC in your project, you will have to disable ARC for the generated ObjC files. To do this, go to the "Compile Sources" section of "Build Phases" of your project and specify the "-fno-objc-arc" compiler flag for all the generated files.
Description: Macintosh HD 2 Mountain Lion:Users:mactester:Downloads:post:screenshot-disableARC.png

4c) If you already have libxml2 installed on your system (look for libxml2.dylib in /usr/lib folder), then skip this step. Otherwise, follow the steps in (4c) to install libxml2 library
4c-1)  Install the macports package installer from http://www.macports.org/install.php (if you don't have it already)
4c-2) Install libxml2 library by executing the following command in a terminal window
        sudo port install libxml2

(*Tip* For the build to work for libxml2, make sure you have the command line tools installed for Xcode )

4d) In the target "Build settings", include "-lxml2" in the "Other Linker Flags"  property
Description: Macintosh HD 2 Mountain Lion:Users:mactester:Downloads:post:screenshot-linkerflags.png

4e) In the target "Build settings", include "$(SDKROOT)/usr/include/libxml2" in the "Header Search Paths"  property

Description: Macintosh HD 2 Mountain Lion:Users:mactester:Downloads:post:screenshot-headerfiles.png

4f) Import "CurrencyConvertorSvc.h" file into your implementation file and use the methods provided by this interface to make the appropriate web services calls.

The following code snippet demonstrate its usage

-(void)processRequest

{

    CurrencyConvertorSoapBinding* binding = [CurrencyConvertorSvcCurrencyConvertorSoapBinding];

    CurrencyConvertorSoapBindingResponse* response;

    CurrencyConvertorSvc_ConversionRate* request = [[CurrencyConvertorSvc_ConversionRatealloc]init];

    request.FromCurrencyCurrencyConvertorSvc_Currency_enumFromString(self.fromCurrencyTextField.text);

    request.ToCurrency = CurrencyConvertorSvc_Currency_enumFromString(self.toCurrencyTextField.text );

    response = [binding ConversionRateUsingParameters:request];

 

    dispatch_async(dispatch_get_main_queue(), ^{

        [self processResponse:response];

    });

}

 

 

-(void) processResponse: (CurrencyConvertorSoapBindingResponse*)soapResponse

{

    NSArray *responseBodyParts = soapResponse.bodyParts;

    id bodyPart;

    [self.activitystopAnimating];

    [self.activityremoveFromSuperview];

    @try{

        bodyPart = [responseBodyParts objectAtIndex:0]; // Assuming just 1 part in response which is fine

 

    }

    @catch (NSException* exception)

    {

        UIAlertView* alert = [[UIAlertViewalloc]initWithTitle:@"Server Error"message:@"Error while trying to process request"delegate:selfcancelButtonTitle:@"OK"otherButtonTitles: nil];

        [alert show];

        return;

    }

 

    if ([bodyPart isKindOfClass:[SOAPFault class]]) {

 

        NSString* errorMesg = ((SOAPFault *)bodyPart).simpleFaultString;

        UIAlertView* alert = [[UIAlertViewalloc]initWithTitle:@"Server Error"message:errorMesg delegate:selfcancelButtonTitle:@"OK"otherButtonTitles: nil];

        [alert show];

    }

    elseif([bodyPart isKindOfClass:[CurrencyConvertorSvc_ConversionRateResponseclass]]) {

        CurrencyConvertorSvc_ConversionRateResponse* rateResponse = bodyPart;

        UIAlertView* alert = [[UIAlertViewalloc]initWithTitle:@"Success!"message:[NSStringstringWithFormat:@"Currency Conversion Rate is %@",rateResponse.ConversionRateResult] delegate:selfcancelButtonTitle:@"OK"otherButtonTitles: nil];

        [alert show];

 

    }

 

}

 

An example project can be downloaded from the following link-  SOAP Test. The project has been built using Xcode 4.5.

6 comments

If you have an iPhone app or are developing one, with the launch of iPhone5 , you  need to ensure that your images scale to support the new taller retina display (640X1136).

In case of the launch image, naming the new launch with the suffix "-568h@2x" (e.g.. Default-568h@2x) will ensure that the system picks up the right launch image for the iPhone5.

However, just adding the "-568h@2x" to the new images is not sufficient to have the system pick the right images for the tall retina display. Here is a very simple category on UIImage that can be used to return the right image. Note that in the category implementation, I assume that all the iPhone5 specific images are named with a suffix of "-568h@2x".

 

The "UIImage+iPhone5extension.h" Interface definition

 

 

 

The "UIImage+iPhone5extension.m" file implementation

 

 

Just include the above files in your project and replace relevant occurrences of [UIImage imageNamed:] call with [UIImage imageNamedForDevice:]. This would ensure that right image is picked up for non-retina,retina and tall retina versions of the resolution.

 

Mobile Video Streaming

Feb 07, 2012

12 comments

Consumption of mobile streaming video is on an upward trend. Supporting video streaming on mobile platforms presents a lot of challenges, primarily due to the diversity of devices. The decisions include encodings , file formats, streaming protocol etc. Content Distribution Networks (CDNs) and video delivery platforms exist today to alleviate the process so you don't have to worry about the video delivery aspect and can focus on the mobile app that consumes the video.
However, in order to make an informed choice about the CDNs and their offerings and the video delivery platforms, a background on mobile streaming technologies is imperative.
I recently gave a presentation at the local Mobile Monday meeting that provides an overview of mobile streaming technologies, mobile platform specific requirements and the challenges. Click Here to download the presentation.

10 comments

If you are interested in developing software (apps, tweaks) for a jailbroken iOS device, then check out my presentation on Developing For Jailbroken iOS platform that I gave at a recent CocoaHeads meeting. This should be a good starting point. The presentation discusses the pros and cons of developing for a jailbroken phone, the various development tools (XCode, Theos) and frameworks (Mobile Substrate) that are available for building applications / run-time patches as well as other relevant information on jailbroken phones (SHSH blobs, jailbreak software etc).

I own an Apple Developer's License and build Apple certified apps for the App Store. I pursue this as a hobby. So hopefully the presentation will get you started.

4 comments

If you are developing for/on a jailbroken iPhone or iPad you are more than likely going to have to SSH into your iDevice a number of times. This includes transferring files to/from the device via SCP. Entering a password every time you have to SSH into the device is very tedious.  Moreover, this becomes imperative if you need automation scripts to SSH/SCP into the device
 
This post explains how you can enable public-key authentication with SSH in order to bypass the password entry process. Note that enabling password-less entry into your iDevice is a potential security risk because anyone with access to your system can now access/control your device without any authentication. So if you enable this, be sure to secure access to your systems!

The steps to enable public-key authentication with the iPhone/iPad are no different than with any UNIX system.
 
The following commands need to be executed on the system from which you would be SSHing into your iPhone/iPad.
If you are using a Mac or a Linux system, the commands are executed from the terminal window.  If you are using a Windows PC, you would have to run these commands within Cygwin

  • Go to the .ssh folder

MyMacBook-Pro-2:~.mactester$ cd ~/.ssh

  • Generate public/private key-pair by running the ssh-keygen command. You will be prompted for some information. You can leave the file to save the key as default. Enter a passphrase . You will be prompted for the passphrase when you try to access your key.

MyMacBook-Pro-2:.ssh mactester$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/Users/mactester/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/mactester/.ssh/id_dsa.
Your public key has been saved in /Users/mactester/.ssh/id_dsa.pub.

  • A public/private key pair would have been generated in the .ssh folder. The .pub file corresponds to the public key.

MyMacBook-Pro-2:.ssh mactester$ ls
id_dsa             id_dsa.pub

  • Copy the PUBLIC KEY over to the ~/.ssh folder of your iPhone/iPad (in this example, the IPAddress of my device is 192.168.1.10)

MyMacBook-Pro-2:.ssh mactester$ scp id_dsa.pub root@192.168.1.10:~/.ssh

The following commands need to be executed on your iPhone/iPad.
For this, you can SSH into the iDevice  (You would still be prompted for a password at this stage) or  you can type in the following commands directly in the terminal application window of your jailbroken iDevice

  • Save the public key as “authorized_keys”. If you already have public keys associated with other systems stored on your device, be sure to append the public key to “authorized_keys2” as shown in the example below. Make sure you set the right access permissions on the key.

MyiPhone:~root# cd ~/.ssh
MyiPhone:~/.ssh root# cat id_dsa.pub >> authorized_keys2
MyiPhone:~/.ssh root#chmod 0600 authorized_keys2

That’s it. The next time you SSH into your iDevice, you will not be prompted for a password.
 

22 comments

iOS devices support the delivery of multimedia content via HTTP progressive download or HTTP Live streaming . As per Apple's guidelines to App developers, "If your app delivers video over cellular networks, and the video exceeds either 10 minutes duration or 5 MB of data in a five minute period, you are required to use HTTP Live Streaming. (Progressive download may be used for smaller clips.)". 

This article discusses a method for generating HTTP live streaming content using freely available tools. If your needs are large scale, then you may need to explore commercial encoders such as the Sorenson Squeeze 7 or other commercial video platforms. This article does not describe commercial video platforms. 

HTTP Live Streaming – A (Very) Brief Overview:

 In HTTP Live streaming, the multimedia stream is segmented into continuous media segments wherein each media chunk/segment holds enough information that would enable decoding of the segment. A playlist file is a list of media URIs, with each URI pointing to a media segment. The media URI’s are specified in the order of playback and the duration of the playlist file is the sum of the durations of the segments. Media playlist files have an “.m3u8” extension. The servers host the media segments and the playlist file. In order to playback content, the media streaming app on the device fetches the playlist file and the media segments based on the media URIs specified in the playlist . The transport protocol is HTTP.
Now, you can have multiple encodings/renditions of the same multimedia content. In this case, you can specify a variant playlist file that will contain URIs to the playlist files corresponding to each rendition of content. In this case, the iDevice can switch between the various encodings thereby adapting to changing network bandwidth conditions. HTTP Live Streaming is essentially a form of adaptive streaming. You can get more details from the IETF I-D available here. Other well-known adaptive streaming protocols include that of Microsoft’s Smooth Streaming , Adobe’s Dynamic Streaming  and the DASH standards specification .

Encoding the content using Handbrake:

  1. Among the free tools, I’ve found Handbrake to be the best in terms of performance and supported formats. Versions are available for Windows and the Mac. In my experience, the Mac version stalled a few times during encoding and at times hogging all the CPU cores on my Macbook Pro. The Windows version worked flawlessly.

  2.  Use the following encoding guidelines provided by Apple to encode your content. If you expect your app users to be able to access the content under a variety of network conditions (wifi, cellular etc), you would want to support multiple encodings of the content .

 
 
 

The Tools for generating content for HTTP Live Streaming :

Once you have encoded your content, you would have to prepare it for delivery via HTTP live streaming. There are a command line utilities available for the Mac that can be downloaded for free from  http://connect.apple.com/ (You would need an Apple developer Id for installing the tools, which again is free). You would need the following tools –

  • mediafilesegmenter

  • variantplaylistcreator

Once installed, they would be available in/usr/bin directory of your Mac.

 Segmenting your encoded content:

Use the mediafilesegmenter tool to segment the encoded media files.  You would need to be “root” user in order to run the tool.
 
/usr/bin/mediafilesegmenter [-b | -base-url <url>]
                        [-t | -target-duration duration]
                        [-f | -file-base path] [-i | -index-file fileName]
                        [-I | -generate-variant-plist]
                        [-B | -base-media-file-name name] [-v | -version]
                        [-k | -encrypt-key file-or-path]
                        [-K | -encrypt-key-url <url>]
                        [-J | -encrypt-iv [random | sequence]]
                        [-key-rotation-period period]
                        [-n | -base-encrypt-key-name name]
                        [-encrypt-rotate-iv-mbytes numberMBytes]
                        [-l | -log-file file] [-F | -meta-file file]
                        [-y | -meta-type [picture | text | id3]]
                        [-M | -meta-macro-file file]
                        [-x | -floating-point-duration] [-q | -quiet]
                        [-a | -audio-only] [-V | -validate-files] [file]
 

 

  • Open a terminal window on your Mac.
  • Type “man mediafilesegmenter”at the command link prompt to get a full description of the usage of the tool.

          <command prompt>$ man mediafilesegmenter
 

  • An example of using the tool to segment a media file named “mymedia_hi.mp4”  is as follows-

        <command prompt>$ sudo /usr/bin/mediafilesegmenter -I -f mymedia_hi -f mymedia_hi.mp4
You will be prompted for the root password (which you must provide)
 
In the example, the media file “mymedia_hi.mp4” is assumed to be present in the current directory from which the command is executed. Otherwise, be sure to specify the path to the media file. The segments will be generated in a subfolder named “mymedia_hi” within the current directory.
 
<command prompt>$ cd mymedia_hi
<command prompt>$ ls
<command prompt>$
fileSequence0.ts           fileSequence14.ts         fileSequence6.ts
fileSequence1.ts           fileSequence15.ts         fileSequence7.ts
fileSequence10.ts         fileSequence2.ts           fileSequence8.ts
fileSequence11.ts         fileSequence3.ts           fileSequence9.ts
fileSequence12.ts         fileSequence4.ts           prog_index.m3u8
fileSequence13.ts         fileSequence5.ts

 
The fileSequence*.ts files correspond to the media segments which are MEPG2 transport streams. The prog_index.m3u8 is the playlist file corresponding to the segmented media file and specifies the media URIs to the segments.
 

  • The “-I” option that I specified in the example command will generate a variant plist file.  The variant plist file would be subsequently required to generate the variant play list file  as described in the next step. You don’t need this option if you don’t plan on streaming multiple encodings of your content.

         Assuming you are in the “mymedia_hi” folder, type the following to get the list of generated variant plist files.
 
<command prompt>$ cd ..
<command prompt>$ ls *.plist
<command prompt>$
mymedia_hi.plist

 

Generating variant playlist file :


If you do not intend to stream multiple renditions of the content , you can skip this step and proceed to the “Streaming the Content” section.

  • Follow the procedures specified in “Segmenting your encoded content” section to segment every encoding of the media content that you wish to stream.  For example, if you plan on supporting three renditions of your media content for high, medium and low network bandwidth conditions respectively, you will have to use the “mediafilesegmenter” tool to segment each of those renditions.

  • Use the tool variantplaylistcreator for generating the variant playlist file.

    /usr/bin/ variantplaylistcreator [-c | -codecs-tags] [-o | -output-file fileName]
    [-v | -version] [<url> <variant.plist> ...]

 

  • Type “man variantplaylistcreator” at the command link prompt to get a full description of the usage of the tool.

    <command prompt>$ man variantplaylistcreator
 

  • An example of using the tool to generate a variant playlist file named “mymedia_all.m3u8”  is as follows-

<command prompt>$ sudo /usr/bin/variantplaylistcreator -o mymedia_all.m3u8 http://mywebserver/mymedia_lo/prog_index.m3u8 mymedia_lo.plist http://mywebserver/mymedia_med/prog_index.m3u8 mymedia_med.plist http://mywebserver/mymedia_hi/prog_index.m3u8 mymedia_hi.plist
 

You will be prompted for the root password (which you must provide)
 
The URL that is associated with the prog_index.m3u8 files for each encoding corresponds to the URL of the webserver that will be used for hosting/streaming the media content.
 

  • The generated variant play list file “mymedia_all.m3u8” will specify the URIs to playlist files (prog_index.m3u8) corresponding to each encoding of the media file. The contents of the file (viewable using your favorite text editor) should be something like this 

#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=87872
http://mywebserver/mymedia_lo/prog_index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=100330
http://mywebserver/mymedia_med/prog_index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1033895
http://mywebserver/mymedia_hi/prog_index.m3u8

 

Streaming the Content:

  1. Upload the variant playlist file (mymedia_all.m3u8 in our example) and ALL the sub-folders that contain the generated segments for every rendition of the media file to the web server that will stream the content. You do not have to copy the media files (eg .mp4 files) from which the segments were generated. You could host it on any regular web server such as the Apache Webserver or Microsoft's IIS. For instance, on an Apache server on Windows, you would copy all this to the “htdocs” folder. This would be something like this-  c:\Program Files(x86)\Apache Software Foundation\Apache2.2\htdocs.

  2. Typically you would need to make no changes to the web server in order to stream the content. In some cases, you may need to update the  webserver configuration file to add support for the .m3u8 MIME type . I had to do this for my IIS web server where I associated the .m3u8 extension with “application/octet-stream” MIME type. 

Note: If your needs are large scale, you would employ the services of a Content Distribution Network (CDN) such as Akamai to publish and distribute your content.

Accessing the Content from your iDevice:

  1. In order to access the streaming content on your iDevice, the media URL must point to the appropriate playlist (.m3u8) file. This would correspond to either the Variant playlist file if you support multiple encodings of the content (mymedia_all.m3u8 in our example) or the prog_index.m3u8 playlist file for the specific encoding of the content.

Example: http://<webserver>/<path to the .m3u8 playlist file>
 
If you do not have a streaming app, you can open the URL in the Safari browser on your device. If everything goes well, the stream should start playing on your device.