Cannot go into dealloc method

iOS, iPad, iPhone, tvOS specific usage questions
trongdth
Blank Cone
Blank Cone
Posts: 13
Joined: 15 Dec 2014 15:21

Cannot go into dealloc method

Postby trongdth » 13 Jan 2015 05:11

when running Dropin-Player sample for iOS, I found we cannot go into dealloc method at VDLPlaybackViewController page when pressing Done button. I guess there is something cannot be released.

Let me know if it's a bug or not!

Thanks

fkuehne
Developer
Developer
Posts: 7264
Joined: 16 Mar 2004 19:37
VLC version: 0.4.6 - present
Operating System: Darwin
Location: Germany
Contact:

Re: Cannot go into dealloc method

Postby fkuehne » 13 Jan 2015 19:12

More information needed.
VideoLAN
Felix Paul Kühne
Medic. VLC developer for appleOS since before you were born.
Blog: https://www.feepk.net

trongdth
Blank Cone
Blank Cone
Posts: 13
Joined: 15 Dec 2014 15:21

Re: Cannot go into dealloc method

Postby trongdth » 14 Jan 2015 06:24

Hi Felix,

Sorry for missing information.

Basically, I add dealloc method into VDLPlaybackViewController.m for Dropin-Player sample:

Code: Select all

- (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; if (_mediaplayer) { @try { [_mediaplayer removeObserver:self forKeyPath:@"time"]; [_mediaplayer removeObserver:self forKeyPath:@"remainingTime"]; } @catch (NSException *exception) { NSLog(@"we weren't an observer yet"); } if (_mediaplayer.media) [_mediaplayer stop]; if (_mediaplayer) _mediaplayer = nil; } if (_idleTimer) { [_idleTimer invalidate]; _idleTimer = nil; } [self.navigationController setNavigationBarHidden:NO animated:YES]; [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade]; } - (void)dealloc { NSLog("it should be called"); }
then I run the application and watch the video. After that, I press DONE button. My expected result is I can see message "it should be called" in console log but it doesn't show anything.

In my opinion, I guessing there is something still not released inside VLCMediaPlayer. Therefore the view controller cannot call dealloc method.

fkuehne
Developer
Developer
Posts: 7264
Joined: 16 Mar 2004 19:37
VLC version: 0.4.6 - present
Operating System: Darwin
Location: Germany
Contact:

Re: Cannot go into dealloc method

Postby fkuehne » 16 Jan 2015 14:48

We never release the view controller in this code sample, so this is why this method is never called.

Since the introduction of ARC, you should not rely on this function, unless it is really really necessary. We have similar code in VLC for iOS and dealloc is de facto unused.
VideoLAN
Felix Paul Kühne
Medic. VLC developer for appleOS since before you were born.
Blog: https://www.feepk.net

trongdth
Blank Cone
Blank Cone
Posts: 13
Joined: 15 Dec 2014 15:21

Re: Cannot go into dealloc method

Postby trongdth » 21 Jan 2015 05:56

Thanks for quick response.

Totally agree with you with ARC dealloc method is unused but for life cycle it still goes inside the dealloc. For my scenario, i need to perform some cleanup on dealloc method so that's why I ask.

Anyway, i will try to cleanup at viewDidDisapear instead.


Return to “VLC for iOS, iPadOS and Apple TV”

Who is online

Users browsing this forum: No registered users and 20 guests