Changing IMAAdDisplayContainer when fullscreen

703 views
Skip to first unread message

Matthew Murray

unread,
Dec 8, 2020, 7:06:29 PM12/8/20
to Interactive Media Ads SDK
On v3.13.0 on iOS our current implementation sets thew UIViewController property on the `IMAAdDisplayContainer` as the UITableViewController in which the video plays. However when the user clicks the video and goes fullscreen, we use a custom full screen video player, which we inject into the main UIWindow in the root view. This is currently causing a crash upon going fullscreen:

libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'child view controller:<IMAAdViewController: 0x7fde64956580> should have parent view controller:<UINavigationController: 0x7fde64015600> but actual parent is:<ArticleListViewController: 0x7fde62f06800>'

Going full screen in custom player worked fine in previous versions of the IMA SDK, but now that we are forced to set the initial UIViewController on the ad request, it seems that it doesn't like it so much when you change the ad's view controller.

I've tried to update the IMAAdDisplayContainer's adContainerViewController property in the moment right before the user goes fullscreen:

    self.imaContainer.adContainerViewController = self.window.rootViewController;

(since the property it is settable...) but that didn't work. I still get the same crash. This is a major issue for us as it prevent videos from playing full screen. What can we do to resolve this or work around it?

Thanks,
Matt





IMA SDK

unread,
Dec 9, 2020, 2:20:15 AM12/9/20
to mmu...@nativo.com, ima...@googlegroups.com

Hi Matthew,

Thank you for reaching out. Were you able to replicate this issue with one of our sample apps for iOS? If yes, kindly share with us a sample project file so we could debug the issue firsthand. You can send the file to our testing alias: imate...@gmail.com.



Regards,

Google Logo
Sherwin Diesta
IMA SDK Team
 


ref:_00D1U1174p._5004Q28oSlb:ref

Matthew Murray

unread,
Dec 15, 2020, 7:15:04 PM12/15/20
to Interactive Media Ads SDK
Hi, I was able to reproduce in the "Basic" sample app. I sent to imate...@gmail.com as you suggested. You'll need to run `pod install` to get it setup.

What I changed:
* in iPhone.storyboard, a UINavigationController is now the initial entry point for the app. The `ViewController` is the UINav controller's rootViewController.
* In `ViewController`, `videoView` property is now nested inside `videoViewContainer`. This needed as the `videoView` gets transferred between here and our fullscreen player.
* Added new methods: expandFullScreen() and exitFullScreen(). When the video player is clicked expandFullScreen() is called and the fullscreen player UI is loaded. The `videoView` gets removed from its parentView and injected into the fullscreen player. When you exit the fullscreen player, exitFullscreen() is called, and `videoView` is added back to original location.

With these changes you can see how the 'UIViewController inconsistency' crash occurs almost immediately on clicking the video. The issue is obviously that IMA SDK is now checking that the UIViewController is consistent across entire playthough, however this breaks our entire fullscreen player when playing VAST ads, and prevents the user from being able to play the video fullscreen.

Let me know what can be done, thanks!

Matt

Matthew Murray

unread,
Dec 15, 2020, 7:20:01 PM12/15/20
to Interactive Media Ads SDK

IMA SDK

unread,
Dec 15, 2020, 10:53:36 PM12/15/20
to mmu...@nativo.com, ima...@googlegroups.com

Hi Matt,

Thank you for sharing the project file. I tried to build the app but with no success, as I kept getting the error message below. Are there any additional steps on how to build the app successfully?
 

line 144: ARCHS[@]: unbound variable
Command PhaseScriptExecution failed with a nonzero exit code.

Matthew Murray

unread,
Dec 16, 2020, 11:44:48 AM12/16/20
to Interactive Media Ads SDK
Strange, it works fine for me. I'm assuming you ran `pod install` in the directory and then opened workspace? What version of Cocoapods are you using? I'm on 1.10.0. Maybe try updating and try again.

Thanks

IMA SDK

unread,
Dec 17, 2020, 12:04:31 AM12/17/20
to mmu...@nativo.com, ima...@googlegroups.com

Hi Matt,

Thank you for your response. Upon further testing, I was able to build the app successfully by changing temporarily the Workspace Setting from "Build System" to "Legacy Build System" as suggested in the below stackoverflow link:
https://stackoverflow.com/questions/53289524/xcode-10-2-1-command-phasescriptexecution-failed-with-a-nonzero-exit-code

Also, I was able to reproduce the crash error you reported (attached screenshot), and with that I’m going to share this information to my teammates to investigate further. Will get back to you once we have our findings.


Regards,


img01.png

Matthew Murray

unread,
Jan 13, 2021, 4:45:31 PM1/13/21
to Interactive Media Ads SDK
Hi,
Any updates on this? Being able to transfer the VAST video from one UIViewController to another is essential for our fullscreen player.

Thanks

IMA SDK

unread,
Jan 13, 2021, 5:35:44 PM1/13/21
to mmu...@nativo.com, ima...@googlegroups.com
Hi Matthew,

Thank you for responding back. I work along with Sherwin and will be helping you todau with this issue. I have looked into it more and see that our team is still looking into this. But have nothing to pass along at this time. Once we hear something back from them we will be certain to let you know as well.

Regards,
Google Logo
William Pescherine
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q28oSlb:ref

Matthew Murray

unread,
Jan 15, 2021, 3:29:08 PM1/15/21
to Interactive Media Ads SDK
Good news, I was able to create a work-around that allows us to use the same root view controller between ad unit and the fullscreen player. Hopefully this solution works and this won't be a blocker for us going forward. However it still would be nice to see some ability to change the UIViewController setting on the `IMAAdDisplayContainer` in some update going forward.

Thanks,
Matt

IMA SDK

unread,
Jan 15, 2021, 4:05:45 PM1/15/21
to mmu...@nativo.com, ima...@googlegroups.com
Hi Matthew,

I work with William and will assist you. Thank you for your feedback. I raised it with the rest of my team. You may monitor our release notes for an update.

Regards,

Google Logo
Aryeh Baker
IMA SDK Team
 


ref:_00D1U1174p._5004Q28oSlb:ref

Aditya Sharma

unread,
Aug 17, 2023, 3:38:55 AM8/17/23
to Interactive Media Ads SDK
Hey Matthew,

Can you please share the workaround that you used to change the viewController?

Regards

Matthew Murray

unread,
Aug 17, 2023, 7:36:54 PM8/17/23
to Interactive Media Ads SDK
The work around was to not change view controllers. We would find the root window and then inject directly onto it. Not the ideal solution we wanted.

Alessandro La Rosa

unread,
Oct 13, 2023, 5:22:55 AM10/13/23
to Interactive Media Ads SDK
Hi,

the issue seems to affect also the latest SDK releases: are there any updates or known workarounds about this issue?

Thanks,
Alessandro

Alessandro La Rosa

unread,
Oct 13, 2023, 5:24:50 AM10/13/23
to Interactive Media Ads SDK
Let me add that unfortunately the mentioned workaround of having the same parent view controller, so avoiding switching, is not applicable in our scenarios.

Thanks,
Alessandro

IMA SDK

unread,
Oct 16, 2023, 12:29:45 PM10/16/23
to alessand...@gmail.com, ima...@googlegroups.com
Hi Alessandro

I've requested an update from our engineers on the feature request, but as of yet we do not have any news to share on this front. For the time being, this should be considered expected behavior.

Thanks,

Greg Schoppe
IMA SDK Team

ref:!00D1U01174p.!5004Q028oSlb:ref
Reply all
Reply to author
Forward
0 new messages