Giter VIP home page Giter VIP logo

Comments (13)

dzenbot avatar dzenbot commented on July 18, 2024

Are these lines called when you dismiss the modal?

if (self.hideBarsWithGestures) {
[self.navigationBar removeObserver:self forKeyPath:@"hidden" context:&DZNWebViewControllerKVOContext];
[self.navigationBar removeObserver:self forKeyPath:@"center" context:&DZNWebViewControllerKVOContext];
[self.navigationBar removeObserver:self forKeyPath:@"alpha" context:&DZNWebViewControllerKVOContext];
}

PS: You shouldn't have to remove observers yourself. It should do it internally.

from dznwebviewcontroller.

jaybuangan avatar jaybuangan commented on July 18, 2024

It crashes when I show the modal. And it happens at random times. Sometimes I can show the modal for a particular link 2 or 3 times before eventually crashing.

Unfortunately Xcode only says it's crashes at the appdelegate class, so I can't give you anymore information:

class AppDelegate: UIResponder, UIApplicationDelegate {

from dznwebviewcontroller.

dzenbot avatar dzenbot commented on July 18, 2024

Try adding an exception breakpoint.
https://developer.apple.com/library/ios/recipes/xcode_help-breakpoint_navigator/articles/adding_an_exception_breakpoint.html

Unless you're using a dynamic framework, it should still point out where the exception is being triggered.

from dznwebviewcontroller.

jaybuangan avatar jaybuangan commented on July 18, 2024

It still showing that same line. I tried to debug step by step and it crashes when i present the viewcontroller.

self.presentViewController(webModalNC, animated: true, completion: nil)

from dznwebviewcontroller.

xradeon avatar xradeon commented on July 18, 2024

You should try weak referencing webModalNC..

from dznwebviewcontroller.

dzenbot avatar dzenbot commented on July 18, 2024

Doesn't look like webModalNC is a property for him. Is it?

from dznwebviewcontroller.

jaybuangan avatar jaybuangan commented on July 18, 2024

I declared webModalNC as weak at the top

'weak var webModalNC: UINavigationController?'

and now it's always nil even after initializing the UINavigationController in showSource().

from dznwebviewcontroller.

dzenbot avatar dzenbot commented on July 18, 2024

Does it need to be a var? Can't you just make it a let in your implementation scope?
Try sharing a gist of your implementation as it is hard to help by guessing..

from dznwebviewcontroller.

xradeon avatar xradeon commented on July 18, 2024
var webModalNC: UINavigationController?

func showSource(url: String) {

    let vc = DZNWebViewController(URL: NSURL(string: url)!)
    self.webModalNC = UINavigationController(rootViewController: vc)
    vc.supportedWebNavigationTools = DZNWebNavigationTools.All
    vc.supportedWebActions = DZNsupportedWebActions.DZNWebActionAll
    vc.showLoadingProgress = true
    vc.hideBarsWithGestures = true
    vc.showPageTitleAndURL = true

    let closeButton = UIBarButtonItem(title: "Close", style: .Plain, target: self, action: #selector(HomeViewController.closeWebModal))
    vc.navigationItem.rightBarButtonItem = closeButton

    self.presentViewController(webModalNC!, animated: true, completion: nil)
}

func closeWebModal() {

    self.webModalNC!.dismissViewControllerAnimated(true, {
        self.webModalNC = nil
    })
}

from dznwebviewcontroller.

jaybuangan avatar jaybuangan commented on July 18, 2024

not sure if i'm doing this right..

https://gist.github.com/jaybuangan/1a8c020ac2b2b213928bc2afa865be22

i took out all the tableview code.

basically there's a view in a tableviewcell that when clicked, calls a delegate function "showSource" which is defined in this view controller. It's just passing a URL string.

from dznwebviewcontroller.

nmvictor avatar nmvictor commented on July 18, 2024

Also crashes for me, same scenario as above. I am showng it as a modal, crashes on exit with debugger pointing to AppDelegate.

from dznwebviewcontroller.

O-mkar avatar O-mkar commented on July 18, 2024

i have the same issue while dismiss view controller

from dznwebviewcontroller.

Cayke avatar Cayke commented on July 18, 2024

Same issue here, crashing on clients but i cant debug because crashlytics dont give enough info for this crash.

Fatal Exception: NSInternalInconsistencyException
An instance 0x14dd45670 of class UINavigationBar was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x170229100> ( <NSKeyValueObservance 0x17005fd70: Observer: 0x14dd24c00, Key path: hidden, Options: <New: YES, Old: NO, Prior: NO> Context: 0x1002c76a8, Property: 0x170251ca0> <NSKeyValueObservance 0x1702585d0: Observer: 0x14dd24c00, Key path: center, Options: <New: YES, Old: NO, Prior: NO> Context: 0x1002c76a8, Property: 0x170251f40> <NSKeyValueObservance 0x170252660: Observer: 0x14dd24c00, Key path: alpha, Options: <New: YES, Old: NO, Prior: NO> Context: 0x1002c76a8, Property: 0x170251d00> )

from dznwebviewcontroller.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.