I've seen this happen whenever i rotate a screen that has a UITableView
on it. I've found out that it happens inbetween the willRotate
and didRotate
method calls in UIViewController
My co-workers have seen it in other spots as well, usually around rotation. It hadnt started happening until very recently, and we're stumped as to how we should deal with it (google searches don't turn up the error message in its exact form). Has anyone else encountered this that knows what to do about it?
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- how do you prevent page scroll in textarea on mobi
- Custom UITableview cell accessibility not working
相关文章
- Could I create “Call” button in HTML 5 IPhone appl
- Unable to process app at this time due to a genera
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
- Open iOS 11 Files app via URL Scheme or some other
- Can keyboard of type UIKeyboardTypeNamePhonePad be
- Can not export audiofiles via “open in:” from Voic
- XCode 4.5 giving me “SenTestingKit/SenTestKit.h” f
I had this problem when i was assumed that:
tableView:heightForHeaderInSection:
returned anNSInteger
, but it returnsCGFloat
...changing:
to
fixed my issue.
Edit:
At some point I figured out how computers work below the C level, so I thought I would share it... (I will use an register names from x86_64 as I am most familiar with them, ARM would be slightly different but analogous)
results in converting the value of
someFloat
to an integer type then copying that to a particular register:%rax
then calling the return instruction.results in copying the value of
someFloat
from its current location to a particular register:%xmm0
then calling the return instruction.So if you have the wrong prototype the calling code will expect the value to be in the wrong place, you will end up really returning a garbage value.
There is an another way to reproduce the issue: using
insetBy(dx:dy:)
on a too small rectI've found the problem.
When you reset the frame of a
tableview
, it calls the delegate methodtableView:heightForRowAtIndexPath:
for each row in the table so it can recalculate its content size if it needs to. At that point, we do some special handling to return the height, and due to some bad assumptions in our code, we mistakenly returnedNaN
due to a divide by zero error (the variable we divide by was assumed to never be zero). Making sure that we do not divide by zero here fixed it.(Decided to take this out of comments and put it as an answer, since I think it's a darned good answer :)
Ha! I had an NaN calculation (div0), too. Key debugging aid: the message in question is output by NSLog(), so set a breakpoint on NSLog() and watch what the OS is doing at that time. For me, it was myUISlider.value = NaN.
To set breakpoint:
XCode 3.x
XCode 4.x
XCode 5.x - 7.1 (at least) (Same as 4.x, except breakpoints navigator is CMD-7, now.)
Run app, watch it break on NSLog, check the stack traces.
This error also cost me a long time.
At the end I found my colleague wrote something like this:
And I rewrote these code like this and fix the issue:
some value of UIEdgeInsets isn't initialised properly, and it sometimes turn into a NaN value, and crash the application.
More generally, you should check whether all values of C-style structs are initialised properly.
You can try this
yourTableview?.bounces = false
. It works for me.