Search code examples
iosobjective-cmpmovieplayercontroller

MPMoviePlayerController set unknown text


I use the MPMoviePlayerController for playing video. It works, but it displays unknown strings which I think it is related to its localization files: enter image description here

The code for playing video is here:

NSString *videoPath = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"m4v"];
NSURL *streamURL = [NSURL fileURLWithPath:videoPath];
MPMoviePlayerController *moviplayer =[[MPMoviePlayerController alloc] initWithContentURL:     streamURL];
[moviplayer prepareToPlay];
[moviplayer.view setFrame: self.view.bounds];
[self.view addSubview: moviplayer.view];
moviplayer.fullscreen = YES;
moviplayer.shouldAutoplay = YES;
moviplayer.repeatMode = MPMovieRepeatModeNone;
moviplayer.movieSourceType = MPMovieSourceTypeFile;
[moviplayer play];

How to solve this problem?


Solution

  • After looking to all part of my project, I find that the below class (category) which is used to set the default language for the application, yields to this bug:

    https://github.com/cmaftuleac/BundleLocalization

    Use this forked class solved my problem by not use swizzling method for UIKit bundle: https://github.com/jbolter/BundleLocalization https://github.com/jbolter/BundleLocalization/commit/4eedcf45a315a4a5f3ddaf9521f3cadec6632bcc