guilhermearaujo / GUITabPagerViewController

MIT License
454 stars 69 forks source link

CRASH on XCode7 #19

Closed elpsk closed 9 years ago

elpsk commented 9 years ago

Hi, if you run this project on XCode7 you get this crash:


2015-09-02 10:11:35.442 GUITabPagerViewController[42606:821468] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* +[NSLayoutConstraint constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:]: A constraint cannot be made between a leading/trailing attribute and a right/left attribute. Use leading/trailing for both or neither.' * First throw call stack: ( 0 CoreFoundation 0x0000000108f7e9b5 exceptionPreprocess + 165 1 libobjc.A.dylib 0x00000001089f6deb objc_exception_throw + 48 2 CoreFoundation 0x0000000108f7e8ed +[NSException raise:format:] + 205 3 Foundation 0x00000001085bff02 +[NSLayoutConstraint constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:] + 299 4 GUITabPagerViewController 0x00000001084ea331 -[GUITabScrollView initWithFrame:tabViews:tabBarHeight:tabColor:backgroundColor:] + 4705 5 GUITabPagerViewController 0x00000001084e9010 -[GUITabScrollView initWithFrame:tabViews:tabBarHeight:tabColor:backgroundColor:selectedTabIndex:] + 240 6 GUITabPagerViewController 0x00000001084e7eec -[GUITabPagerViewController reloadTabs] + 3596 7 GUITabPagerViewController 0x00000001084e6e1d -[GUITabPagerViewController reloadData] + 909 8 GUITabPagerViewController 0x00000001084e87e8 -[ViewController viewWillAppear:] + 88 9 UIKit 0x00000001094b87b6 -[UIViewController _setViewAppearState:isAnimating:] + 710 10 UIKit 0x00000001094b8e50 -[UIViewController viewWillAppear:] + 149 11 UIKit 0x00000001094f43f2 -[UINavigationController _startTransition:fromViewController:toViewController:] + 771 12 UIKit 0x00000001094f53a9 -[UINavigationController _startDeferredTransitionIfNeeded:] + 890 13 UIKit 0x00000001094f61ad -[UINavigationController viewWillLayoutSubviews] + 57 14 UIKit 0x00000001096882d1 -[UILayoutContainerView layoutSubviews] + 248 15 UIKit 0x00000001093d9a3b -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 710 16 QuartzCore 0x000000010cd9236a -[CALayer layoutSublayers] + 146 17 QuartzCore 0x000000010cd86bd0 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366 18 QuartzCore 0x000000010cd86a4e _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24 19 QuartzCore 0x000000010cd7b1d5 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277 20 QuartzCore 0x000000010cda89f0 _ZN2CA11Transaction6commitEv + 508 21 QuartzCore 0x000000010cda9154 _ZN2CA11Transaction17observer_callbackEP19CFRunLoopObservermPv + 92 22 CoreFoundation 0x0000000108eaa457 CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION** + 23 23 CoreFoundation 0x0000000108eaa3c7 __CFRunLoopDoObservers + 391 24 CoreFoundation 0x0000000108e9f93c CFRunLoopRunSpecific + 524 25 UIKit 0x0000000109327d2d -[UIApplication _run] + 402 26 UIKit 0x000000010932c99e UIApplicationMain + 171 27 GUITabPagerViewController 0x00000001084e8eef main + 111 28 libdyld.dylib 0x000000010b58992d start + 1 29 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException


Changing

NSLayoutAttributeLeading to NSLayoutAttributeLeft seems works...

  [self setTabIndicatorDisplacement:[NSLayoutConstraint constraintWithItem:tabIndicator
                                                               attribute:NSLayoutAttributeLeft
                                                               relatedBy:NSLayoutRelationEqual
                                                                  toItem:contentView
                                                               attribute:NSLayoutAttributeLeft
                                                              multiplier:1.0f
                                                                constant:widthDifference / 2 + 5]];
QHexacoda commented 9 years ago

Yes, NSLayoutAttributeLeading working for me as well. Thanks @elpsk

fabio-nogueira-almeida commented 9 years ago

Me too. Changing NSLayoutAttributeLeading to NSLayoutAttributeLeft works well.