GithubHelp home page GithubHelp logo

Comments (7)

orojasnypost avatar orojasnypost commented on May 28, 2024 1

Thanks for your help.

  1. All views and layout updating is done in the main thread.
  2. Pin.logWarnings = true is nowhere in our code
  3. I tried validating that the superView of the previous view isn't nil before pinning it. Now we'll have to wait until the fix is released and see if it fixes the crash. Thank you!

from pinlayout.

lucdion avatar lucdion commented on May 28, 2024 1

Good, for now I will close the issue, if the issue persist you could reopen it later

from pinlayout.

lucdion avatar lucdion commented on May 28, 2024

@orojasnypost, the method referenceSuperview() is trying to show you a warning that the view don't have a superview, which means that the view you are trying to layout has not been added yet to another view, so PinLayout is unable to layout it.

I can't explain why it crashes in viewDescription, but adding the view you are layouting to a superview should fix your issue.

internal func referenceSuperview(_ referenceView: PinView, _ context: Context) -> PinView? {
        if let superview = referenceView.superview {
            return superview as? PinView
        } else {
            warnWontBeApplied("the reference view \(viewDescription(referenceView)) must be added as a sub-view before being used as a reference.", context)
            return nil
        }
    }

from pinlayout.

lucdion avatar lucdion commented on May 28, 2024

Also, normally PinLayout's warnings shouldn't be generated in release builds because Pin.logWarnings is false in release mode. Are you testing a DEBUG build?

internal func warnWontBeApplied(_ text: String, _ context: Context) {
        guard Pin.logWarnings else { return }
        warn("\(context()) won't be applied, \(text)")
    }

from pinlayout.

orojasnypost avatar orojasnypost commented on May 28, 2024

@orojasnypost, the method referenceSuperview() is trying to show you a warning that the view don't have a superview, which means that the view you are trying to layout has not been added yet to another view, so PinLayout is unable to layout it.

I can't explain why it crashes in viewDescription, but adding the view you are layouting to a superview should fix your issue.

internal func referenceSuperview(_ referenceView: PinView, _ context: Context) -> PinView? {
        if let superview = referenceView.superview {
            return superview as? PinView
        } else {
            warnWontBeApplied("the reference view \(viewDescription(referenceView)) must be added as a sub-view before being used as a reference.", context)
            return nil
        }
    }

We are adding the view we are layouting to the superView, all subviews are added to the superview before layouting. That's why I reached out for solutions and created this issue, because I don't have an idea of why is the referenceView nil but something is happening inside PinLayout IMHO because we aren't doing anything unusual, we use pinLayout regularly in all our views but this is the one that is reporting a problem in firebase.

from pinlayout.

orojasnypost avatar orojasnypost commented on May 28, 2024

Also, normally PinLayout's warnings shouldn't be generated in release builds because Pin.logWarnings is false in release mode. Are you testing a DEBUG build?

internal func warnWontBeApplied(_ text: String, _ context: Context) {
        guard Pin.logWarnings else { return }
        warn("\(context()) won't be applied, \(text)")
    }

Crashlytics is only generating a crash report with this title:

<compiler-generated> line 2147483647

If you check the stack trace I shared above you'll see that it reports the crash here in frame 1:

Crashed: com.apple.main-thread
0 libswiftCore.dylib 0x3da990 swift_getObjectType + 40
1 PinLayout 0x2557c PinLayout.viewDescription(_:) + 4375287164 (:4375287164)

I came to the conclusion that the crash is ocurring there after debugging with breakpoints. But we aren't receiving any warning, this is in production code. Not a Debug build.

from pinlayout.

lucdion avatar lucdion commented on May 28, 2024
  • If you are able to reproduce the issue, you could check in your loop for (n, uiView) in frameView.enumerated() that all your view's superview are valid.

  • Check that all views layout and update are done on the main thread.

  • Check you don't set Pin.logWarnings to true anywhere on your code.

We have never encountered this issue before, its really strange 🤔

from pinlayout.

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.