Hi,
Since updating to version 3.5.2 I have been seeing the error: "Ads cannot be requested because the ad container is not attached to the view hierarchy".
For sure my view is in the view hierarchy but what I noticed is this:
when I call remove from superview before the video view controller is disappearing and destroying IMA instance the IMA SDK probably doesn't reset it's states and in the next time I request ads it fails with this error, on the first time everything works fine and it usually happens if I quit in the middle of an ad.
Thanks,
Gal
if (adsManager != nil) {
self.videoView.removeFromSuperview()
adsManager!.destroy()
adsManager = nil
}
Hi Arnaud,
I am getting exact same issue in my app while requesting IMALIVEStreamRequest with asset key .
For the first time its working fine after that I am getting error like this
Ads cannot be requested because the ad container is not attached to the view hierarchy
FYI before every ads request I am resetting adcontainer properly here is code snippet .
-(void)requestDAIStreamWithAssestKey:(NSString *)assetKey avplayer:(AVPlayer *)player andAdContainer:(UIView *)adContainer{
// Create an ad display container for ad rendering.
self.adDisplayContainer =
[[IMAAdDisplayContainer alloc] initWithAdContainer:adContainer companionSlots:nil];
// Create an IMAAVPlayerVideoDisplay to give the SDK access to your video player.
self.IMAVideoDisplay =
[[IMAAVPlayerVideoDisplay alloc] initWithAVPlayer:player];
// Create a stream request. Use one of "Live stream request".
self.liveStreamRequest =
[[IMALiveStreamRequest alloc] initWithAssetKey:assetKey
adDisplayContainer:self.adDisplayContainer
videoDisplay:self.IMAVideoDisplay];
if (_daiDelegate == nil) {
_daiDelegate = [NDDAIListener new];
}
self.adsLoader.delegate = _daiDelegate;
[self.adsLoader requestStreamWithRequest:self.liveStreamRequest];
}
I checked iOS Advance Example unfortunately couldn't not able to reproduce the behaviour
as IMALIVEStreamRequest is not at all made in those sample apps .
Kindly help me out with this .
Thanks and regards
Shakti
Hi Shakti,
Thank you for your response. Just wanted to confirm if you were able to reproduce this issue using our iOS AdvancedExample sample app? If yes, kindly provide the Asset Key that you’re using and steps in order for us to reproduce the behavior on our end.
Regards,
Sherwin Diesta
IMA SDK Team
Hi Manasa,
Thank you for your message. Our advanced integration sample app for SDK DAI iOS does use assetKey when requesting a live stream, please see attached screenshot. Let me know if you would be able to use this to compare against your implementation.
Regards,
Sherwin Diesta
IMA SDK Team