Comments (7)
Thanks for your help.
- All views and layout updating is done in the main thread.
- Pin.logWarnings = true is nowhere in our code
- 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.
Good, for now I will close the issue, if the issue persist you could reopen it later
from pinlayout.
@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.
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, the method
referenceSuperview()
is trying to show you a warning that the view don't have asuperview
, 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.
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.
-
If you are able to reproduce the issue, you could check in your loop
for (n, uiView) in frameView.enumerated()
that all your view'ssuperview
are valid. -
Check that all views layout and update are done on the main thread.
-
Check you don't set
Pin.logWarnings
totrue
anywhere on your code.
We have never encountered this issue before, its really strange 🤔
from pinlayout.
Related Issues (20)
- "view.keyboardLayoutGuide.layoutFrame" is (0,0,0,0) before using "view.pin.keyboardMargins".
- How do I auto-size the container of image view and label? HOT 5
- invalid parameter not satisfying: !cgsizeequaltosize(size, cgsizezero) HOT 7
- Can I use autoSizeThatFits on collection view cell ? HOT 5
- Can I let View A cover B half? HOT 2
- How to align base line of two UILabels?
- Interview partners for research about communication in GitHub projects wanted
- H
- Unable to build with Carthage HOT 2
- Crash: PinLayout.swift - Line 1236
- How to use with NSSplitViewController? HOT 3
- How to add separator line below row/cell?
- UIButton with image .aspectRation() not work HOT 1
- Attach view to different edges or use priorities
- Document missing link HOT 1
- ABI stability for swift evolution support for different swift versions
- Problem with sizeToFit - autoSizing HOT 1
- Edge offsets (.top(x), .bottom(x), .start(x), .end(x)) aren't used in autoSizeThatFits HOT 1
- Work on watchOS?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pinlayout.