iphone Programming Glossary: fileurlwithpath
How do I record audio on iPhone with AVAudioRecorder? http://stackoverflow.com/questions/1010343/how-do-i-record-audio-on-iphone-with-avaudiorecorder NSString stringWithFormat @ @ @.caf DOCUMENTS_FOLDER caldate retain NSURL url NSURL fileURLWithPath recorderFilePath err nil recorder AVAudioRecorder alloc initWithURL url settings recordSetting error.. recorder recordForDuration NSTimeInterval 10 void stopRecording recorder stop NSURL url NSURL fileURLWithPath recorderFilePath NSError err nil NSData audioData NSData dataWithContentsOfFile url path options 0 error..
Reading ePub format http://stackoverflow.com/questions/1388467/reading-epub-format unzipped the zip file to in 3 plus the base directory of the OPF file in 6 8 create an NSURL using fileURLWithPath where the path is the full path from 7c . Load this request using the UIWebView you created in 1 . You'll..
Adding Core Data to existing iPhone project http://stackoverflow.com/questions/2032818/adding-core-data-to-existing-iphone-project if persistentStoreCoordinator nil return persistentStoreCoordinator NSURL storeUrl NSURL fileURLWithPath self applicationDocumentsDirectory stringByAppendingPathComponent @ Core_Data.sqlite NSError error nil..
Implementation of “Automatic Lightweight Migration” for Core Data (iPhone) http://stackoverflow.com/questions/2310216/implementation-of-automatic-lightweight-migration-for-core-data-iphone if persistentStoreCoordinator nil return persistentStoreCoordinator NSURL storeUrl NSURL fileURLWithPath self applicationDocumentsDirectory stringByAppendingPathComponent @ FC.sqlite NSError error nil persistentStoreCoordinator.. if persistentStoreCoordinator nil return persistentStoreCoordinator NSURL storeUrl NSURL fileURLWithPath self applicationDocumentsDirectory stringByAppendingPathComponent @ YOURDB.sqlite handle db upgrade.. NSString path NSBundle mainBundle pathForResource @ YOURDB ofType @ momd NSURL momURL NSURL fileURLWithPath path managedObjectModel NSManagedObjectModel alloc initWithContentsOfURL momURL return managedObjectModel..
Play sound on iPhone even in silent mode http://stackoverflow.com/questions/3740528/play-sound-on-iphone-even-in-silent-mode variable AVAudioPlayer player NSString path NSBundle mainBundle pathForResource... NSURL url NSURL fileURLWithPath path player AVAudioPlayer alloc initWithContentsOfURL url When that's done you can play with it any..
How do I export UIImage array as a movie? http://stackoverflow.com/questions/3741323/how-do-i-export-uiimage-array-as-a-movie Wire the writer NSError error nil AVAssetWriter videoWriter AVAssetWriter alloc initWithURL NSURL fileURLWithPath somePath fileType AVFileTypeQuickTimeMovie error error NSParameterAssert videoWriter NSDictionary videoSettings..
iPhone Facebook Video Upload http://stackoverflow.com/questions/5355846/iphone-facebook-video-upload NSString filePath NSBundle mainBundle pathForResource @ Test ofType @ mp4 NSURL fileURL NSURL fileURLWithPath filePath NSData data NSData dataWithContentsOfFile filePath NSMutableDictionary params NSMutableDictionary..
Make movie file with picture Array and song file, using AVAsset http://stackoverflow.com/questions/6061092/make-movie-file-with-picture-array-and-song-file-using-avasset Write Started NSError error nil AVAssetWriter videoWriter AVAssetWriter alloc initWithURL NSURL fileURLWithPath path fileType AVFileTypeMPEG4 error error NSParameterAssert videoWriter NSDictionary videoSettings.. Write Started NSError error nil AVAssetWriter videoWriter AVAssetWriter alloc initWithURL NSURL fileURLWithPath path fileType AVFileTypeMPEG4 error error NSParameterAssert videoWriter NSDictionary videoSettings.. audio_inputFilePath Utilities documentsPath audio_inputFileName NSURL audio_inputFileUrl NSURL fileURLWithPath audio_inputFilePath NSString video_inputFileName @ essai.mp4 NSString video_inputFilePath Utilities..
Using HTML and Local Images Within UIWebView http://stackoverflow.com/questions/747407/using-html-and-local-images-within-uiwebview the view with the correct baseURL NSString path NSBundle mainBundle bundlePath NSURL baseURL NSURL fileURLWithPath path webView loadHTMLString htmlString baseURL baseURL You can then refer to your images like this img..
Play music in the background using AVAudioplayer http://stackoverflow.com/questions/7619794/play-music-in-the-background-using-avaudioplayer this code in your controller's view did load method like this void viewDidLoad NSURL url NSURL fileURLWithPath NSBundle mainBundle pathForResource @ in the storm ofType @ mp3 AVAudioPlayer audioPlayer AVAudioPlayer..
Get Exif data from UIImage - UIImagePickerController http://stackoverflow.com/questions/9766394/get-exif-data-from-uiimage-uiimagepickercontroller objectForKey @ kCGImageSourceTypeIdentifierHint isEqualToString @ public.tiff fileURL NSURL fileURLWithPath NSString stringWithFormat @ @ @. @ documentsDirectory @ myimage sourceOptionsDict objectForKey..
How do I record audio on iPhone with AVAudioRecorder? http://stackoverflow.com/questions/1010343/how-do-i-record-audio-on-iphone-with-avaudiorecorder 0 NSString caldate now description recorderFilePath NSString stringWithFormat @ @ @.caf DOCUMENTS_FOLDER caldate retain NSURL url NSURL fileURLWithPath recorderFilePath err nil recorder AVAudioRecorder alloc initWithURL url settings recordSetting error err if recorder NSLog @ recorder @ d @ err domain err code.. show cantRecordAlert release return start recording recorder recordForDuration NSTimeInterval 10 void stopRecording recorder stop NSURL url NSURL fileURLWithPath recorderFilePath NSError err nil NSData audioData NSData dataWithContentsOfFile url path options 0 error err if audioData NSLog @ audio data @ d @ err domain err..
Reading ePub format http://stackoverflow.com/questions/1388467/reading-epub-format user. Work out what the full path is hint it's wherever you unzipped the zip file to in 3 plus the base directory of the OPF file in 6 8 create an NSURL using fileURLWithPath where the path is the full path from 7c . Load this request using the UIWebView you created in 1 . You'll need to implement forward backward buttons or swipes or..
Adding Core Data to existing iPhone project http://stackoverflow.com/questions/2032818/adding-core-data-to-existing-iphone-project added to it. NSPersistentStoreCoordinator persistentStoreCoordinator if persistentStoreCoordinator nil return persistentStoreCoordinator NSURL storeUrl NSURL fileURLWithPath self applicationDocumentsDirectory stringByAppendingPathComponent @ Core_Data.sqlite NSError error nil persistentStoreCoordinator NSPersistentStoreCoordinator alloc..
Implementation of “Automatic Lightweight Migration” for Core Data (iPhone) http://stackoverflow.com/questions/2310216/implementation-of-automatic-lightweight-migration-for-core-data-iphone in this way NSPersistentStoreCoordinator persistentStoreCoordinator if persistentStoreCoordinator nil return persistentStoreCoordinator NSURL storeUrl NSURL fileURLWithPath self applicationDocumentsDirectory stringByAppendingPathComponent @ FC.sqlite NSError error nil persistentStoreCoordinator NSPersistentStoreCoordinator alloc initWithManagedObjectModel.. YOURDB NSPersistentStoreCoordinator persistentStoreCoordinator if persistentStoreCoordinator nil return persistentStoreCoordinator NSURL storeUrl NSURL fileURLWithPath self applicationDocumentsDirectory stringByAppendingPathComponent @ YOURDB.sqlite handle db upgrade NSDictionary options NSDictionary dictionaryWithObjectsAndKeys..
Play sound on iPhone even in silent mode http://stackoverflow.com/questions/3740528/play-sound-on-iphone-even-in-silent-mode you can instanciate sounds like this probably an instance variable AVAudioPlayer player NSString path NSBundle mainBundle pathForResource... NSURL url NSURL fileURLWithPath path player AVAudioPlayer alloc initWithContentsOfURL url When that's done you can play with it any time you want with player play Play the sound player pause Pause..
How do I export UIImage array as a movie? http://stackoverflow.com/questions/3741323/how-do-i-export-uiimage-array-as-a-movie frames to a video stream. Essentially you ™ll have to 1 Wire the writer NSError error nil AVAssetWriter videoWriter AVAssetWriter alloc initWithURL NSURL fileURLWithPath somePath fileType AVFileTypeQuickTimeMovie error error NSParameterAssert videoWriter NSDictionary videoSettings NSDictionary dictionaryWithObjectsAndKeys AVVideoCodecH264..
iPhone Facebook Video Upload http://stackoverflow.com/questions/5355846/iphone-facebook-video-upload _upload.apiKey kApiKey _upload.appSecret kApiSecret NSString filePath NSBundle mainBundle pathForResource @ Test ofType @ mp4 NSURL fileURL NSURL fileURLWithPath filePath NSData data NSData dataWithContentsOfFile filePath NSMutableDictionary params NSMutableDictionary dictionaryWithObjectsAndKeys data @ @ test @ title..
Make movie file with picture Array and song file, using AVAsset http://stackoverflow.com/questions/6061092/make-movie-file-with-picture-array-and-song-file-using-avasset @ @ @ documentsDirectoryPath tString error nil NSLog @ Write Started NSError error nil AVAssetWriter videoWriter AVAssetWriter alloc initWithURL NSURL fileURLWithPath path fileType AVFileTypeMPEG4 error error NSParameterAssert videoWriter NSDictionary videoSettings NSDictionary dictionaryWithObjectsAndKeys AVVideoCodecH264.. @ @ @ documentsDirectoryPath tString error nil NSLog @ Write Started NSError error nil AVAssetWriter videoWriter AVAssetWriter alloc initWithURL NSURL fileURLWithPath path fileType AVFileTypeMPEG4 error error NSParameterAssert videoWriter NSDictionary videoSettings NSDictionary dictionaryWithObjectsAndKeys AVVideoCodecH264.. NSString audio_inputFileName @ deformed.caf NSString audio_inputFilePath Utilities documentsPath audio_inputFileName NSURL audio_inputFileUrl NSURL fileURLWithPath audio_inputFilePath NSString video_inputFileName @ essai.mp4 NSString video_inputFilePath Utilities documentsPath video_inputFileName NSURL video_inputFileUrl NSURL..
Using HTML and Local Images Within UIWebView http://stackoverflow.com/questions/747407/using-html-and-local-images-within-uiwebview work with UIWebView. Instead you have to load the HTML into the view with the correct baseURL NSString path NSBundle mainBundle bundlePath NSURL baseURL NSURL fileURLWithPath path webView loadHTMLString htmlString baseURL baseURL You can then refer to your images like this img src myimage.png from uiwebview revisited share improve..
Play music in the background using AVAudioplayer http://stackoverflow.com/questions/7619794/play-music-in-the-background-using-avaudioplayer some changes in .plist file of our application.. Update write this code in your controller's view did load method like this void viewDidLoad NSURL url NSURL fileURLWithPath NSBundle mainBundle pathForResource @ in the storm ofType @ mp3 AVAudioPlayer audioPlayer AVAudioPlayer alloc initWithContentsOfURL url error nil AVAudioSession..
Get Exif data from UIImage - UIImagePickerController http://stackoverflow.com/questions/9766394/get-exif-data-from-uiimage-uiimagepickercontroller sourceRef 0 imagePropertiesDictionary if sourceOptionsDict objectForKey @ kCGImageSourceTypeIdentifierHint isEqualToString @ public.tiff fileURL NSURL fileURLWithPath NSString stringWithFormat @ @ @. @ documentsDirectory @ myimage sourceOptionsDict objectForKey @ kCGImageSourceTypeIdentifierHint componentsSeparatedByString..
How do I record audio on iPhone with AVAudioRecorder? http://stackoverflow.com/questions/1010343/how-do-i-record-audio-on-iphone-with-avaudiorecorder now description recorderFilePath NSString stringWithFormat @ @ @.caf DOCUMENTS_FOLDER caldate retain NSURL url NSURL fileURLWithPath recorderFilePath err nil recorder AVAudioRecorder alloc initWithURL url settings recordSetting error err if recorder NSLog.. return start recording recorder recordForDuration NSTimeInterval 10 void stopRecording recorder stop NSURL url NSURL fileURLWithPath recorderFilePath NSError err nil NSData audioData NSData dataWithContentsOfFile url path options 0 error err if audioData..
Reading ePub format http://stackoverflow.com/questions/1388467/reading-epub-format it's wherever you unzipped the zip file to in 3 plus the base directory of the OPF file in 6 8 create an NSURL using fileURLWithPath where the path is the full path from 7c . Load this request using the UIWebView you created in 1 . You'll need to implement..
Adding Core Data to existing iPhone project http://stackoverflow.com/questions/2032818/adding-core-data-to-existing-iphone-project persistentStoreCoordinator if persistentStoreCoordinator nil return persistentStoreCoordinator NSURL storeUrl NSURL fileURLWithPath self applicationDocumentsDirectory stringByAppendingPathComponent @ Core_Data.sqlite NSError error nil persistentStoreCoordinator..
Implementation of “Automatic Lightweight Migration” for Core Data (iPhone) http://stackoverflow.com/questions/2310216/implementation-of-automatic-lightweight-migration-for-core-data-iphone persistentStoreCoordinator if persistentStoreCoordinator nil return persistentStoreCoordinator NSURL storeUrl NSURL fileURLWithPath self applicationDocumentsDirectory stringByAppendingPathComponent @ FC.sqlite NSError error nil persistentStoreCoordinator.. persistentStoreCoordinator if persistentStoreCoordinator nil return persistentStoreCoordinator NSURL storeUrl NSURL fileURLWithPath self applicationDocumentsDirectory stringByAppendingPathComponent @ YOURDB.sqlite handle db upgrade NSDictionary options.. return managedObjectModel NSString path NSBundle mainBundle pathForResource @ YOURDB ofType @ momd NSURL momURL NSURL fileURLWithPath path managedObjectModel NSManagedObjectModel alloc initWithContentsOfURL momURL return managedObjectModel share improve..
iPhone : can we open pdf file using UIWebView? http://stackoverflow.com/questions/2832245/iphone-can-we-open-pdf-file-using-uiwebview 10 10 200 200 NSString path NSBundle mainBundle pathForResource @ document ofType @ pdf NSURL targetURL NSURL fileURLWithPath path NSURLRequest request NSURLRequest requestWithURL targetURL webView loadRequest request self.view addSubview webView..
Play sound on iPhone even in silent mode http://stackoverflow.com/questions/3740528/play-sound-on-iphone-even-in-silent-mode an instance variable AVAudioPlayer player NSString path NSBundle mainBundle pathForResource... NSURL url NSURL fileURLWithPath path player AVAudioPlayer alloc initWithContentsOfURL url When that's done you can play with it any time you want with player..
How do I export UIImage array as a movie? http://stackoverflow.com/questions/3741323/how-do-i-export-uiimage-array-as-a-movie you ™ll have to 1 Wire the writer NSError error nil AVAssetWriter videoWriter AVAssetWriter alloc initWithURL NSURL fileURLWithPath somePath fileType AVFileTypeQuickTimeMovie error error NSParameterAssert videoWriter NSDictionary videoSettings NSDictionary..
Save Youtube video to iPhone in the app http://stackoverflow.com/questions/5087249/save-youtube-video-to-iphone-in-the-app the output stream file handle and rename or delete the temporary file as appropriate. To play it back just use NSURL's fileURLWithPath to create a URL pointing to the local file in the Documents directory and play it as you would any remote video. share..
iPhone Facebook Video Upload http://stackoverflow.com/questions/5355846/iphone-facebook-video-upload kApiSecret NSString filePath NSBundle mainBundle pathForResource @ Test ofType @ mp4 NSURL fileURL NSURL fileURLWithPath filePath NSData data NSData dataWithContentsOfFile filePath NSMutableDictionary params NSMutableDictionary dictionaryWithObjectsAndKeys..
Make movie file with picture Array and song file, using AVAsset http://stackoverflow.com/questions/6061092/make-movie-file-with-picture-array-and-song-file-using-avasset error nil NSLog @ Write Started NSError error nil AVAssetWriter videoWriter AVAssetWriter alloc initWithURL NSURL fileURLWithPath path fileType AVFileTypeMPEG4 error error NSParameterAssert videoWriter NSDictionary videoSettings NSDictionary dictionaryWithObjectsAndKeys.. error nil NSLog @ Write Started NSError error nil AVAssetWriter videoWriter AVAssetWriter alloc initWithURL NSURL fileURLWithPath path fileType AVFileTypeMPEG4 error error NSParameterAssert videoWriter NSDictionary videoSettings NSDictionary dictionaryWithObjectsAndKeys.. @ deformed.caf NSString audio_inputFilePath Utilities documentsPath audio_inputFileName NSURL audio_inputFileUrl NSURL fileURLWithPath audio_inputFilePath NSString video_inputFileName @ essai.mp4 NSString video_inputFilePath Utilities documentsPath video_inputFileName..
Using HTML and Local Images Within UIWebView http://stackoverflow.com/questions/747407/using-html-and-local-images-within-uiwebview load the HTML into the view with the correct baseURL NSString path NSBundle mainBundle bundlePath NSURL baseURL NSURL fileURLWithPath path webView loadHTMLString htmlString baseURL baseURL You can then refer to your images like this img src myimage.png from..
Play music in the background using AVAudioplayer http://stackoverflow.com/questions/7619794/play-music-in-the-background-using-avaudioplayer Update write this code in your controller's view did load method like this void viewDidLoad NSURL url NSURL fileURLWithPath NSBundle mainBundle pathForResource @ in the storm ofType @ mp3 AVAudioPlayer audioPlayer AVAudioPlayer alloc initWithContentsOfURL..
Get Exif data from UIImage - UIImagePickerController http://stackoverflow.com/questions/9766394/get-exif-data-from-uiimage-uiimagepickercontroller if sourceOptionsDict objectForKey @ kCGImageSourceTypeIdentifierHint isEqualToString @ public.tiff fileURL NSURL fileURLWithPath NSString stringWithFormat @ @ @. @ documentsDirectory @ myimage sourceOptionsDict objectForKey @ kCGImageSourceTypeIdentifierHint..
|