Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9168285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:35:33+00:00 2026-06-17T15:35:33+00:00

I recently found an answer on stackoverflow of how to store an image inside

  • 0

I recently found an answer on stackoverflow of how to store an image inside of an App:

-(void) saveImage:(UIImage *)image withFileName:(NSString *)imageName ofType:(NSString *)extension inDirectory:(NSString *)directoryPath {
if ([[extension lowercaseString] isEqualToString:@"png"]) {
    [UIImagePNGRepresentation(image) writeToFile:[directoryPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", imageName, @"png"]] options:NSAtomicWrite error:nil];
} else if ([[extension lowercaseString] isEqualToString:@"jpg"] || [[extension lowercaseString] isEqualToString:@"jpeg"]) {
    [UIImageJPEGRepresentation(image, 1.0) writeToFile:[directoryPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", imageName, @"jpg"]] options:NSAtomicWrite error:nil];
} else {
    ALog(@"Image Save Failed\nExtension: (%@) is not recognized, use (PNG/JPG)", extension);
}
}

How can I store a video that a user chooses from photo/video library and save it inside app? Is it any different? I’m trying to keep track of a list of videos that a user want’s to upload and when he/she ready they can upload all those videos to the app’s server.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:35:34+00:00Added an answer on June 17, 2026 at 3:35 pm

    Well, i don’t really understand your purposes, but you may try using NSFileManager in order to just copy a file from one URL to another:

    NSError *error;
    [[NSFileManager defaultManager] copyItemAtURL:mediaURL toURL:outputURL error:&error];
    

    If you need to manipulate your movie in some way (i.e. cropping, changing quality), you should be using AVExportSession:

    + (void)writeMovieAtURL:(NSURL *)mediaURL
                      toURL:(NSURL *)outputURL
                 withQality:(NSInteger)quality
          completionHandler:(void (^)(NSURL *, NSError *))completion {
    
    
        AVURLAsset *asset = [AVURLAsset URLAssetWithURL:mediaURL options:nil];
    
    
        NSArray *compatiblePresets = [AVAssetExportSession exportPresetsCompatibleWithAsset:asset];
        NSString *exportPreset;
    
        switch (quality) {
            case 0 : { exportPreset = AVAssetExportPreset1280x720;      } break;
            case 1 : { exportPreset = AVAssetExportPreset640x480;       } break;
            case 2 : { exportPreset = AVAssetExportPresetMediumQuality; } break;
            case 3 : { exportPreset = AVAssetExportPresetLowQuality;    } break;
        }
    
        if (nil != exportPreset && [compatiblePresets containsObject:exportPreset]) {
            AVAssetExportSession *exportSession = [[AVAssetExportSession alloc]
                                      initWithAsset:asset presetName:exportPreset];
    
            exportSession.outputURL = outputURL;
    
            exportSession.outputFileType = AVFileTypeQuickTimeMovie;
    
            // set some params to the session
    
            [exportSession exportAsynchronouslyWithCompletionHandler:^{                
                switch ([exportSession status]) {
                    case AVAssetExportSessionStatusCompleted: {                       
                        completion(outputURL, nil);
                        [exportSession release];
                    } break;
                    case AVAssetExportSessionStatusWaiting : {
                        NSLog(@"Export Waiting");
                    } break;
                    case AVAssetExportSessionStatusExporting : {
                        NSLog(@"Export Exporting");
                    } break;
                    case AVAssetExportSessionStatusFailed : {
                        completion(outputURL, [exportSession error]);
                        [exportSession release];
                    } break;
                    case AVAssetExportSessionStatusCancelled : {
                        NSDictionary *userInfo = [NSDictionary dictionaryWithObject:@"Movie export session canceled"
                                                                             forKey:@"ocalizedDescription"];                        
                        NSError *error = [NSError errorWithDomain:@"your.domain" 
                                                             code:123 
                                                         userInfo:userInfo];                        
                        completion(outputURL, error);
                        [exportSession release];
                    } break;
                }
            }];
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently found an answer to one of my questions here on stackoverflow which
The obvious answer is to use Charset.defaultCharset() but we recently found out that this
I recently found some code like this: typedef int TenInts[10]; void foo(TenInts &arr); What
I'm a game programmer working in Korea. I started Stackoverflow recently and I found
I recently found a problem in a Rails app related to duplicate entries in
recently found an article in http://hashtwo.com/blog/integrating-a-file-browser-into-ckeditor-cakephp to integrate a file browser into ckeditor (file
I recently found that dynamically creating object and methods in Ruby is quite a
I recently found javafx 2.1 very useful for my project of making a video
I recently found the mobipick calendar and I really like it due to its
I recently found that one of my services was taking a large amount of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.