Iphone 如果(NSClassFromString(@";MPMoviePlayerServiceController";)!=nil)出现此情况,如何使设备3.1.3不通过
在设备3.1.2上运行时,为什么还要传递if(NSClassFromString(@“MPMoviePlayerServiceWController”)!=nil 而iOS4的代码会崩溃吗,如何解决这个问题Iphone 如果(NSClassFromString(@";MPMoviePlayerServiceController";)!=nil)出现此情况,如何使设备3.1.3不通过,iphone,iphone-sdk-3.0,compatibility,media-player,ios4,Iphone,Iphone Sdk 3.0,Compatibility,Media Player,Ios4,在设备3.1.2上运行时,为什么还要传递if(NSClassFromString(@“MPMoviePlayerServiceWController”)!=nil 而iOS4的代码会崩溃吗,如何解决这个问题 if(NSClassFromString(@"MPMoviePlayerViewController") != nil) { // iOS 4 code NSLog(@"MPMoviePlayerViewController");
if(NSClassFromString(@"MPMoviePlayerViewController") != nil) {
// iOS 4 code
NSLog(@"MPMoviePlayerViewController");
MPMoviePlayerViewController *mp = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:AppDelegate.PushLink]];
if (mp) {
// save the movie player object
self.theMovie4 = mp;
[mp release];
//Present
[self presentMoviePlayerViewControllerAnimated:self.theMovie4];
// Play the movie!
self.theMovie4.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;
[self.theMovie4.moviePlayer play];
}
}
else {
//iOS 3 Code
AppDelegate = nil;
AppDelegate = [[UIApplication sharedApplication] delegate];
[AppDelegate ForceHideNavigationBar];
theMovie3 = nil;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePreloadDidFinish:)
name:MPMoviePlayerContentPreloadDidFinishNotification
object:theMovie3];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:theMovie3];
// Register to receive a notification when the movie scaling mode has changed.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(movieScalingModeDidChange:)
name:MPMoviePlayerScalingModeDidChangeNotification
object:theMovie3];
theMovie3 = [[MPMoviePlayerController alloc] initWithContentURL: [NSURL URLWithString:AppDelegate.PushLink]];
[theMovie3 play];
}
我用过:
if (NSClassFromString(@"MPMoviePlayerViewController") != nil
&& [UIViewController instancesRespondToSelector: @selector(presentMoviePlayerViewControllerAnimated:)]) {
// iOS 4