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

  • Home
  • SEARCH
  • 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 6033191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:26:52+00:00 2026-05-23T05:26:52+00:00

I am using AVCaptureSession class to capture video. This class only active for Device

  • 0

I am using AVCaptureSession class to capture video. This class only active for Device mode. Other functionality working both simulator and device. How to handle this class for Simulator mode. Whether i have to command this class? please advice.

  • 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-05-23T05:26:53+00:00Added an answer on May 23, 2026 at 5:26 am

    You can do this using three methods :

    • At compilation, by using preprocessor directive :

      #if TARGET_IPHONE_SIMULATOR
      // simulator code
      #else
      // device code
      #endif
      
    • At runtime (more complex), by checking device :

      // Simple version :
      if ([[[UIDevice currentDevice] model] isEqualToString:@"iPhone Simulator"]) {
         // code
      }
      

      OR

      // More precise version:
      - (NSString *) platform{
        size_t size;
        sysctlbyname("hw.machine", NULL, &size, NULL, 0);
        char *machine = malloc(size);
        sysctlbyname("hw.machine", machine, &size, NULL, 0);
        NSString *platform = [NSString stringWithCString:machine encoding:NSUTF8StringEncoding];
        free(machine);
        return platform;
      }
      
      - (NSString *) platformString{
        NSString *platform = [self platform];
        if ([platform isEqualToString:@"iPhone1,1"])    return @"iPhone1G";
        if ([platform isEqualToString:@"iPhone1,2"])    return @"iPhone3G";
        if ([platform isEqualToString:@"iPhone2,1"])    return @"iPhone3GS";
        if ([platform isEqualToString:@"iPhone3,1"])    return @"iPhone4";
        if ([platform isEqualToString:@"iPod1,1"])      return @"iPodTouch1G";
        if ([platform isEqualToString:@"iPod2,1"])      return @"iPodTouch2G";
        if ([platform isEqualToString:@"iPod3,1"])      return @"iPodTouch3G";
        if ([platform isEqualToString:@"iPod4,1"])      return @"iPodTouch4G";
        if ([platform isEqualToString:@"iPad1,1"])      return @"iPad";
        if ([platform isEqualToString:@"iPad2,1"])      return @"iPad2Wifi";
        if ([platform isEqualToString:@"iPad2,2"])      return @"iPad2GSM";
        if ([platform isEqualToString:@"iPad2,3"])      return @"iPad2CDMA";
        if ([platform isEqualToString:@"i386"])         return @"iPhoneSimulator";
        return platform;
      }
      
    • At project build settings by excluding files depending on SDK (even more complex, but useful for librairies) :

      "EXCLUDED_SOURCE_FILE_NAMES[sdk=iphoneos*][arch=*]" = ...
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was able to capture video frames from the camera using AVCaptureSession according to
I'm using AVAssetWriter with a AVAssetWriterInputPixelBufferAdaptor to capture video from an AVCaptureSession. I'm writing
I am using an AVCaptureSession to capture audio and video samples from the devices
Using C#, I need a class called User that has a username, password, active
I'm using the AVFoundation classes to capture the live video stream from the camera
I was wondering if it was possible to capture from both cameras simultaneously using
I am using the following code to capture video and save it to the
I am trying to record video using AVFoundation. When I add video input only
Using of mobile dialog authentication is working well for other mobile devices except on
I'm capturing images using this code #pragma mark - image capture // Create and

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.