简体   繁体   中英

Application is getting crash while presenting view controller modally

I am getting following exception when I am presenting modal view controller:

" Application tried to present modally an active controller <ViewController: 0x16e9d270> "

But this crash is occurs only in one case.

Basically I am adding subview (webview) to the presented controller. All loading of html contents, webview delegate methods implementation etc. is done in another class.

I am passing the webview object, which I am receiving In webViewDidFinishLoad method to the presenting view controller to add it into the to be presented controller's subview.

It is working, but app is getting crash if below html response is received from server:

<script type="text/javascript">document.write('<iframe frameborder="0" width="300" height="250" marginheight="0" marginwidth="0" target="_blank" scrolling="no" src="http://nym1.mobile.adnxs.com/if?e=wqT_3QKHBPBC_gEAAAIA1gAFCNnhtKYFEKmko7ePueCUbRikrovh65Dzh38gASotCeF6FK5H4co_EYqw4emVssQ_GQAAAAAAAPA_IRESBCnhDSSwMPK4-QE4rhVA7AdIAlDD4e0LWMr-ImAGaLPkA3AAeOrWAoABAYoBA1VTRJIBAQbwb5gBrAKgAfoBqAEGsAEAuAEBwAEFyAEA0AEA2AEA4AEA8AEAigJ0dWYoJ2EnLCA0NTEyMjQsIDE0MjI3MzM1MjkpO3VmKCdjJywgNjk4NjYzNCwgMTQyMjczMzUyOSk7dWYoJ2cnLCAxNzEwMTAxLCA-HQAocicsIDI0ODY3MDE6HgDwipICnQEhaVNhX2ZBaUt0Nm9ERU1QaDdRc1lBQ0RLX2lJd0FEZ0FRQUJJN0FkUThyajVBVmdBWU13RWFBQndBSGdBZ0FFQWlBRUFrQUVCbUFFQm9BRUJxQUVEc0FFQXVRSGhlaFN1Ui1IS1A4RUI0WG9VcmtmaHlqX0pBWVYxbWJIVHl2NF8yUUVBQUEBAyREd1AtQUJBUFVCAQ4wQUEuLpoCHSF4UVo2UDqgALh5djRpSUFBLtgCAOACrqQcgAMAiAMBkAMAmAMAoAMAqgMAsAMAuAMAwAOsAsgDAQ..&dlo=1"></iframe>');</script>

Application is not crashing if I do all the webview delegate methods implementation in the to be presented view controller. Means loads the html contents in the modal view controller itself.

Unable to understand the reason of crash

我想您将Web视图对象传递给了呈现的视图控制器,但是该对象的委托仍然引用呈现的视图控制器,这就是问题所在。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM