How to Download and Store Media With the iPhone SDK
The iPhone SDK allows programmers to create iPhone and iPad apps for your users' mobile devices that run the Apple iOS operating system. You use this SDK, short for Software Development Kit, to download media such as music or videos that display on the iPhone when the user wants to play those media file.
Instructions
-
-
1
Open the iPhone SDK development software on your computer. Open the project you want to use to download the media file.
-
2
Set up the directory in which you want to store the files and the file you want to download. The following code sets up a temporary folder for the file and an MP3 file to download:
NSString *folder = NSTemporaryDirectory();
NSString *file = [tempPath stringByAppendingPathComponent:@"mymusic.mp3"]; -
-
3
Set the file to automatically download and store in the folder you specified. Add code like the following to set up the file to download to the folder:
[self.fileData file:folder automatically:YES];
-
4
Display the file in the iPhone window. In this example, the MP3 file runs on the phone, so the user can listen to music. Add the following code to display or run the file:
[webView file MIMEType:@"application/mp3" textEncodingName:@"UTF-8"];
-
1