-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XLPagerTabStrip.ButtonBarView.move() : Crash in ButtonBarView.swift, line 81 #575
Comments
EXC_BAD_ACCESS happens in open func move(fromIndex: Int, toIndex: Int, progressPercentage: CGFloat, pagerScroll: PagerScroll) --> let fromFrame = layoutAttributesForItem(at: IndexPath(item: fromIndex, section: 0))!.frame |
We are experiencing crashes with Version 8.0.1 in ButtonBarView.swift, line 81: Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value --> let fromFrame = layoutAttributesForItem(at: IndexPath(item: fromIndex, section: 0))!.frame |
@rkittinger @hao-li check ButtonBarView type. that UICollectionView type. |
@hyuni what do mean? |
@rkittinger @hao-li @ThomGru Make sure that when you added your ButtonBarView to your Storyboard that you added a UICollectionView and not a plain UIView. Even if you set the UIView's class type to |
The same issue, change |
When I changed |
Also ran into this problem and fixed it by making the control a This could be a lot more obvious by changing the wording in the README.md file. |
The instructions README says UIView specifically?? |
Already using |
Try setting the buttonbarview before super.viewDidLoad() |
Settings buttonbarview style before super.viewDidLoad() fixed it. https://medium.com/michaeladeyeri/how-to-implement-android-like-tab-layouts-in-ios-using-swift-3-578516c3aa9 |
Still getting the error with version 9.0 and setting barbuttonview style before super.viewDidLoad() ButtonBarView.swift - Line 81 |
If you're setting up programatically, make sure to add your subviews and constraints before import UIKit
import XLPagerTabStrip
class InboxViewController: ButtonBarPagerTabStripViewController, InboxViewProtocol {
var presenter: InboxPresenterProtocol?
lazy var scrollView = UIScrollView()
lazy var barView: ButtonBarView = {
let layout = UICollectionViewFlowLayout()
let frame = CGRect(x: 0, y: 0, width: view.frame.width, height: 64)
let collectionView = ButtonBarView(frame: frame, collectionViewLayout: layout)
collectionView.backgroundColor = .red
return collectionView
}()
override func viewDidLoad() {
view.addSubview(scrollView)
containerView = scrollView
scrollView.snp.makeConstraints { $0.edges.equalToSuperview() }
view.addSubview(barView)
buttonBarView = barView
barView.snp.makeConstraints {
$0.top.equalToSuperview()
$0.left.equalToSuperview()
$0.right.equalToSuperview()
$0.height.equalTo(64)
}
super.viewDidLoad()
}
override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
return [InboxRouter.createBuyerInbox(), InboxRouter.createSellerInbox()]
}
} |
This error occured for me when I used a
before super.viewDidLoad so, make sure you are not doing anythin heavy before super.load (ex DispatchQueue.main.async) |
We are experiencing crashes with Version 8.0.0 in ButtonBarView.swift, line 81:
XLPagerTabStrip.ButtonBarView.move(fromIndex: Swift.Int, toIndex: Swift.Int, progressPercentage: CoreGraphics.CGFloat, pa.....
Incident Identifier: CE2A8647-3EFF-4CCF-8A50-B32F6FF43288
CrashReporter Key: D2F3275C-B5EA-4528-91BD-7C86CC9DD08F
Hardware Model: iPhone9,3
Code Type: ARM-64
Parent Process: ??? [1]
Date/Time: 2018-04-26T23:39:50Z
Launch Time: 2018-04-26T22:59:52Z
OS Version: iPhone OS 11.3 (15E216)
Report Version: 104
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0xfffffffffffffff8
Crashed Thread: 0
Application Specific Information:
Selector name found in current argument registers: indexAtPosition:
Thread 0 Crashed:
0 UIKit 0x000000018f1cda9c -[UICollectionViewData layoutAttributesForItemAtIndexPath:] + 248
1 UIKit 0x000000018f1d58a4 -[UICollectionView layoutAttributesForItemAtIndexPath:] + 144
2 XLPagerTabStrip 0x0000000102970da8 XLPagerTabStrip.ButtonBarView.move(fromIndex: Swift.Int, toIndex: Swift.Int, progressPercentage: CoreGraphics.CGFloat, pagerScroll: XLPagerTabStrip.PagerScroll) -> () (ButtonBarView.swift:81)
3 XLPagerTabStrip 0x0000000102967d5c XLPagerTabStrip.ButtonBarPagerTabStripViewController.updateIndicator(for: XLPagerTabStrip.PagerTabStripViewController, fromIndex: Swift.Int, toIndex: Swift.Int, withProgressPercentage: CoreGraphics.CGFloat, indexWasChanged: Swift.Bool) -> () (ButtonBarPagerTabStripViewController.swift:247)
4 XLPagerTabStrip 0x000000010296c88c protocol witness for XLPagerTabStrip.PagerTabStripIsProgressiveDelegate.updateIndicator(for: XLPagerTabStrip.PagerTabStripViewController, fromIndex: Swift.Int, toIndex: Swift.Int, withProgressPercentage: CoreGraphics.CGFloat, indexWasChanged: Swift.Bool) -> () in conformance XLPagerTabStrip.ButtonBarPagerTabStripViewController : XLPagerTabStrip.PagerTabStripIsProgressiveDelegate in XLPagerTabStrip (ButtonBarPagerTabStripViewController.swift:0)
5 XLPagerTabStrip 0x00000001029800d8 XLPagerTabStrip.PagerTabStripViewController.updateContent() -> () (PagerTabStripViewController.swift:277)
6 XLPagerTabStrip 0x000000010297d7dc XLPagerTabStrip.PagerTabStripViewController.updateIfNeeded() -> () (PagerTabStripViewController.swift:189)
7 XLPagerTabStrip 0x0000000102983b48 XLPagerTabStrip.PagerTabStripViewController.viewDidLayoutSubviews() -> () (PagerTabStripViewController.swift:144)
8 XLPagerTabStrip 0x0000000102983b80 @objc XLPagerTabStrip.PagerTabStripViewController.viewDidLayoutSubviews() -> () (PagerTabStripViewController.swift:0)
9 XLPagerTabStrip 0x00000001029669ec XLPagerTabStrip.ButtonBarPagerTabStripViewController.viewDidLayoutSubviews() -> () (ButtonBarPagerTabStripViewController.swift:177)
10 XLPagerTabStrip 0x0000000102966e84 @objc XLPagerTabStrip.ButtonBarPagerTabStripViewController.viewDidLayoutSubviews() -> () (ButtonBarPagerTabStripViewController.swift:0)
11 UIKit 0x000000018f07b8e4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1788
12 QuartzCore 0x000000018961d25c -[CALayer layoutSublayers] + 180
13 QuartzCore 0x00000001896213ec CA::Layer::layout_if_needed(CA::Transaction*) + 320
14 UIKit 0x000000018f093c70 -[UIView(Hierarchy) layoutBelowIfNeeded] + 544
15 UIKit 0x000000018f04850c -[UIView(Geometry) setFrame:] + 656
16 UIKit 0x000000018f51b2b0 -[UIViewController autoresizeArchivedView] + 108
17 UIKit 0x000000018f51ac0c -[UIViewController _loadViewFromNibNamed:bundle:] + 672
18 UIKit 0x000000018f15e0f0 -[UIViewController loadView] + 172
19 UIKit 0x000000018f082b90 -[UIViewController loadViewIfRequired] + 168
20 UIKit 0x000000018f082acc -[UIViewController view] + 24
21 UIKit 0x000000018fa597c8 -[UIPageViewController _setViewControllers:withScrollInDirection:animated:completion:] + 516
22 UIKit 0x000000018fa59a7c -[UIPageViewController setViewControllers:direction:animated:completion:] + 264
23 test 0x0000000100cdc8a8 OurApp.MainPagedViewController.viewDidLoad() -> () (MainPagedViewController.swift:86)
....
The text was updated successfully, but these errors were encountered: