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 856517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:14:50+00:00 2026-05-15T08:14:50+00:00

my device are running on OS4 GM and it not present Mediaplayer when play.

  • 0

my device are running on OS4 GM and it not present Mediaplayer when play. when test on os3.1.3 it work well.
when i target to deploy on OS4 it will resolve this issue, how can i fix it?

Here is my code
.h

  #if __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_3_2
MPMoviePlayerController *theMovie;
  #endif
//On a 4.0 device, implement the MPMoviePlayerViewController
  #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
MPMoviePlayerViewController *theMovie;
  #endif



//If iPhone OS is 3.1 or less, implement the MPMoviePlayerController
  #if __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_3_2
@property (readwrite, retain) MPMoviePlayerController *theMovie;
  #endif
//On a 4.0 device, implement the MPMoviePlayerViewController
  #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
@property (readwrite, retain) MPMoviePlayerViewController *theMovie;
  #endif

.m

 #if __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_3_2

                    NSLog(@"__IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_3_2");

                    AppDelegate = nil;

                    AppDelegate = [[UIApplication sharedApplication] delegate];

                    [AppDelegate ForceHideNavigationBar];

                    theMovie = nil;

                    // Register to receive a notification that the movie is now in memory and ready to play

                    [[NSNotificationCenter defaultCenter] addObserver:self 

                                                                       selector:@selector(moviePreloadDidFinish:) 

                                                                            name:MPMoviePlayerContentPreloadDidFinishNotification 

                                                                         object:theMovie];



                    // Register to receive a notification when the movie has finished playing. 

                    [[NSNotificationCenter defaultCenter] addObserver:self 

                                                                       selector:@selector(moviePlayBackDidFinish:) 

                                                                            name:MPMoviePlayerPlaybackDidFinishNotification 

                                                                         object:theMovie];



                    // Register to receive a notification when the movie scaling mode has changed. 

                    [[NSNotificationCenter defaultCenter] addObserver:self 

                                                                       selector:@selector(movieScalingModeDidChange:) 

                                                                            name:MPMoviePlayerScalingModeDidChangeNotification 

                                                                         object:theMovie];



                    theMovie = [[MPMoviePlayerController alloc] initWithContentURL: [NSURL URLWithString:AppDelegate.PushLink]];

                    theMovie.scalingMode = MPMovieScalingModeAspectFill;
                    [theMovie play];



  #endif               

                    //On a 4.0 device, implement the MPMoviePlayerViewController

  #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2

                    // Initialize a movie player object with the specified URL

                    MPMoviePlayerViewController *mp = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:AppDelegate.PushLink]];

                    if (mp) {



                         self.theMovie = mp;

                         [mp release];

                         //Present

                         [self presentMoviePlayerViewControllerAnimated:theMovie];



                         // Play the movie!

                         self.theMovie.moviePlayer.movieSourceType = MPMovieSourceTypeFile;

                         [self.theMovie.moviePlayer play];

                    }

  #endif
  • 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-15T08:14:51+00:00Added an answer on May 15, 2026 at 8:14 am

    I you want to target both iOS3 and iOS4, you don’t want to use conditional compilation (#if statements). Conditional compilation resolves at compile time but you want something that can change its behavior at runtime based on which system the user is running.

    You actually want to use “weak linking”.

    1. Set your Base SDK to iOS4. Set the
      iPhone OS Deployment Target to iOS3
    2. Declare both properties but in
      your code check if
      ([MPMoviePlayerViewController class]
      != nil)
      . If it’s not nil, use the
      MPMoviePlayerViewController,
      otherwise, use the old one.

    For more on weak linking, see:

    • Apple’s: Framework Programming
      Guide: Frameworks and Weak
      Linking
      Stackoverflow: How do
      you optionally use iPhone OS 3.0
      features in a 2.0 compatible app?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently developing for a handheld device running Windows XP Professional (not Tablet PC
I have an embedded device running busybox . The device has crond installed and
I want to create a purpose built device capable of running a java vm
How can I programmatically get the phone number of the device that is running
When running on the device: Program received signal: EXC_BAD_ACCESS. Debugger: #0 0x31e11158 in CALayerCollectLayers_
I am running an application overnight on my Linux xscale device. I am looking
Hi Im running linux angstrom distribution on a remote device, I added .bash_profile and
I have the following code running on my Android device. It works great and
My aplication needs to use device language even when it is running in background.
I'm programming for an embedded device with a NVIDIA Tegra 2 running Windows Embedded

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.