iphone - __IPHONE_OS_VERSION_MIN_REQUIRED please explain -


I am developing an app that I would like to deploy for iPhone 3.0, iPhone 4.0, and which can run on the iPad Are simulation mode.

I'm developing with XCode 3.2.3 and I have video for playback. I want to use MPMoviePlayerViewController> = 3.2 and MPMoviePlayerController for & lt ; . 3.2

If I use

  Class mplayerControllerClass = NSClassFromString (@ "MPMoviePlayerViewController"); If (! MplayerControllerClass = Zero) {MPMoviePlayerViewController * moviePlayerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL: movieUrl]; ...}  

Will an iPhone handle a square with OS 3.0 which he does not know?

Is it good to insert code inside code? > __ IPHONE_OS_VERSION_MIN_REQUIRED & gt; 30200 ifelse block? Like this:

  class mplayerControllerClass = NSClassFromString (@ "MPMPViewer Viewer"); If (mplayerControllerClass = Zero!) {__IPHONE_OS_VERSION_MIN_REQUIRED & gt #if; = 30200 MPMoviePlayerViewController * moviePlayerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL: movieUrl]; ...}  

but what does __iPHONE_OS_VERSION_MIN_REQUIRED actually do? I think it just repeats the settings I set for my project: min = 3.0

< P> On your first snippet, you are creating a class based on NSString . It is possible because you link your structure to weak, so the earlier versions of OS do not crash in this situation. It is done in runtime, and will work as you expect.

The second snippet, on the other hand, uses a precompiler conditional. It will not have any effect for you to use the MPMoviePlayerViewController , you will be using a base SDK of 4.0 Since then, then #if will always be true.

Conclusion: Add any weakness to what you want, go ahead with your first piece, and make sure the frameworks are weaker connected

< / Div>

Comments

Popular posts from this blog

paypal - How to know the URL referrer in PHP? -

oauth - Facebook OAuth2 Logout does not remove fb_ cookie -

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -