播放视频iPhone时内存泄漏 [英] Memory leaks when playing a video iPhone

查看:120
本文介绍了播放视频iPhone时内存泄漏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在我的应用上播放一个简单的视频.我一直在互联网上看如何播放视频,发现需要导入MediaPlayer.framwork.我有一个名为:

I need to play a simple video on my app. I been looking on the internet on how to play a video and I found out that I need to import the MediaPlayer.framwork which I did. I have a Video named:

以及我要播放的代码:

NSString *url = [[NSBundle mainBundle] 
                 pathForResource:@"Final_Valores_Pacific" 
                 ofType:@"m4v"];


MPMoviePlayerController *player = 
                                [[MPMoviePlayerController alloc] 
                                initWithContentURL:[NSURL fileURLWithPath:url]];

我丢失了将其添加到视图中的代码,但是仅此代码会导致泄漏:

I am missing the code to add it to a view but just that code creates a leak:

什么是播放视频的正确方法?如何避免内存泄漏?

what is the right way of playing a video? how can avoid that memory leak?

推荐答案

您在模拟器上遇到此泄漏了吗?我是在过去只在模拟器上工作的应用程序上获得此功能的,而在iPhone上却没有.

Are you getting this leak on the simulator? I got this on an app that I worked on in the past only on the simulator, but not on the iPhone.

对此也有类似的问题:

iPhone:OpenAL& AudioToolbox泄漏

这篇关于播放视频iPhone时内存泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆