stefanceriu / SCPageViewController

Just like UIPageViewController but better.. :)
MIT License
352 stars 70 forks source link

Crash if page's autolayout is enabled #5

Closed jiayuzhang closed 9 years ago

jiayuzhang commented 9 years ago

If any page's view controller enable autolayout, the app will crash. I can't post the pieces of code i'm current working on since my repo is private. However, i managed to reproduce the similar exception through following way. Go SCPageViewController's Demo, enable "autolayout" in SCMainViewController.xib. The app crashes with:

SCPageViewController[568:60b] * Assertion failure in -[NSISLinearExpression incrementConstant:], /SourceCache/Foundation/Foundation-1047.25/Layout.subproj/IncrementalSimplex/NSISLinearExpression.m:620 2015-03-02 23:32:54.938 SCPageViewController[568:60b] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: isfinite(c)' *\ First throw call stack: (0x3037ef0b 0x3ab15ce7 0x3037eddd 0x30d2be2f 0x30ce6291 0x30ce5493 0x30ce50e5 0x30cf09a5 0x32ca13f1 0x30ce4d33 0x32ca1275 0x32bad7bf 0x32ca1357 0x30ce4d33 0x32ca1275 0x32bad7bf 0x32ca1357 0x30ce4d33 0x32ca1275 0x32bad7bf 0x32ca1357 0x30ce4d33 0x32ca1275 0x32bad7bf 0x32caa28d 0x32caa209 0x32caa045 0x32bad8d7 0x32bad40d 0x32bad263 0x32bba01d 0x32bb9a93 0x32bb95b5 0x32bb6dd9 0x32c20a51 0xeed69 0x32c1dcc1 0x32c1d613 0x32c17cc9 0x32bb3c97 0x32bb2df9 0x32c17405 0x35220b55 0x3522073f 0x30349847 0x303497e3 0x30347faf 0x302b2769 0x302b254b 0x32c1662b 0x32c11891 0xf8eed 0x3b013ab7) libc++abi.dylib: terminating with uncaught exception of type NSException

stefanceriu commented 9 years ago

Hey,

I can't get it to crash only by enabling autolayout. Did you do anything else ?

jiayuzhang commented 9 years ago

Oh, I deploy the demo on my iphone5, I changed the Deployment Target to 7.1 and the Devices to Universal

stefanceriu commented 9 years ago

Cool, so I managed to reproduce it by running on an iPhone simulator.

I'm not really sure what the problem is but it seems to be related to the way the nib file was created, probably because the old one was created when the app wasn't universal..

Anyway, I deleted the old nib, created a new one, set its size to iPhone and everything started working properly.

Thanks, Stefan