__IPHONE_OS_VERSION_MIN_REQUIRED, please explain

I am developing an application that I would like to deploy for iPhone 3.0, iPhone 4.0 and which can work on the iPad in emulation mode.

I am developing with Xcode 3.2.3 and I have a video to play. I would like to use MPMoviePlayerViewControllerfor> = 3.2 and MPMoviePlayerControllerfor <3.2.

If i use

Class mplayerControllerClass = NSClassFromString(@"MPMoviePlayerViewController");
if(mplayerControllerClass != nil) 
{
    MPMoviePlayerViewController* moviePlayerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:movieUrl];

   ...
}

Can an iPhone with OS 3.0 handle a class that it does not know?

Is it good to put code inside an __IPHONE_OS_VERSION_MIN_REQUIRED > 30200ifelse block ? eg:

Class mplayerControllerClass = NSClassFromString(@"MPMoviePlayerViewController");
if(mplayerControllerClass != nil) {
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 30200
   MPMoviePlayerViewController* moviePlayerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:movieUrl];
    ...
}

but what does it __IPHONE_OS_VERSION_MIN_REQUIREDreally do? It seems to me that it just repeats the settings that I configured for my project: min = 3.0

+3
2

NSString. , , . , .

, , . , MPMoviePlayerViewController SDK 4.0, #if .

: - , , , .

+2

__IPHONE_OS_VERSION_MIN_REQUIRED: , . #if, , , .

, , , :

Class mplayerControllerClass = NSClassFromString(@"MPMoviePlayerViewController");
if(mplayerControllerClass != nil) {
    id moviePlayerViewController = [[mplayerControllerClass alloc] initWithContentURL:movieUrl];
    ...
}

, MPMoviePlayerViewController , , ( , , / ). , 3.0. (, Apple OpenGL ES CADisplayLink.)

+2

Source: https://habr.com/ru/post/1756793/


All Articles