CKViewPager icon indicating copy to clipboard operation
CKViewPager copied to clipboard

Crashing when I swipe right and left quickly, Tab index gets off and finally crash.

Open aftabnaqvi opened this issue 10 years ago • 13 comments

2015-10-30 23:29:33.975 Saba[2335:1157297] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: [views count] == 3' *** First throw call stack: (0x182bd0f5c 0x1977c3f80 0x182bd0e2c 0x183abff3c 0x1888faad8 0x1888fe304 0x1888f9de8 0x18812300c 0x187929f14 0x187924b20 0x1879249e0 0x18792407c 0x187923dd0 0x187976b00 0x183e5e018 0x182b728e0 0x182b88cdc 0x182b88414 0x182b8616c 0x182ab4dc0 0x18dc08088 0x18818ef60 0x100066930 0x197fee8b8) libc++abi.dylib: terminating with uncaught exception of type NSException

Call stack does not give much information to me. I am pasting the call stack here.

Thread 1Queue : com.apple.main-thread (serial) #0 0x000000019810b1e0 in __pthread_kill () #1 0x00000001981d4f0c in pthread_kill () #2 0x000000019807eb78 in abort () #3 0x0000000196e413f4 in abort_message () #4 0x0000000196e5de98 in default_terminate_handler() () #5 0x00000001977c4248 in _objc_terminate() () #6 0x0000000196e5af44 in std::__terminate(void ()()) () #7 0x0000000196e5a85c in __cxa_throw () #8 0x00000001977c4094 in objc_exception_throw () #9 0x0000000182bd0e2c in +NSException raise:format:arguments: #10 0x0000000183abff3c in -NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description: #11 0x00000001888faad8 in -_UIQueuingScrollView _replaceViews:updatingContents:adjustContentInsets:animated: #12 0x00000001888fe304 in -_UIQueuingScrollView _didScrollWithAnimation:force: #13 0x00000001888f9de8 in -_UIQueuingScrollView layoutSubviews #14 0x000000018812300c in -UIView(CALayerDelegate) layoutSublayersOfLayer: #15 0x0000000187929f14 in -CALayer layoutSublayers #16 0x0000000187924b20 in CA::Layer::layout_if_needed(CA::Transaction) () #17 0x00000001879249e0 in CA::Layer::layout_and_display_if_needed(CA::Transaction*) () #18 0x000000018792407c in CA::Context::commit_transaction(CA::Transaction*) () #19 0x0000000187923dd0 in CA::Transaction::commit() () #20 0x0000000187976b00 in CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) () #21 0x0000000183e5e018 in IODispatchCalloutFromCFMessage () #22 0x0000000182b728e0 in __CFMachPortPerform () #23 0x0000000182b88cdc in CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION () #24 0x0000000182b88414 in __CFRunLoopDoSource1 () #25 0x0000000182b8616c in __CFRunLoopRun () #26 0x0000000182ab4dc0 in CFRunLoopRunSpecific () #27 0x000000018dc08088 in GSEventRunModal () #28 0x000000018818ef60 in UIApplicationMain () #29 0x0000000100066930 in main at /Users/snaqvi/Github/SabaApp/SabaApp/main.m:14 #30 0x0000000197fee8b8 in start ()

aftabnaqvi avatar Oct 31 '15 06:10 aftabnaqvi

I am also getting the same crash. Any fixes found ?

shinoys222 avatar Dec 16 '15 18:12 shinoys222

nope, didn't find any fix.

aftabnaqvi avatar Jan 04 '16 23:01 aftabnaqvi

Same here. This makes this component unusable unfortunately.

ycastonguay-cbc avatar Jan 05 '16 20:01 ycastonguay-cbc

How many tabs are you guys using?

brianinator avatar Jan 05 '16 20:01 brianinator

I am using 4 to 7 tabs in different situations.

aftabnaqvi avatar Jan 05 '16 20:01 aftabnaqvi

Can you post configuration code?

brianinator avatar Jan 05 '16 20:01 brianinator

I'm using 3 to 4 tabs. It's really easy to reproduce the issue, just spawn UIViewControllers with labels indicating the current tab index and scroll quickly from a tab to another. The tab button scrollview works pretty well but if you use swipe gestures to swap from a tab to another before a tab has finished scrolling it will be easy to reproduce the issue.

ycastonguay-cbc avatar Jan 05 '16 21:01 ycastonguay-cbc

@interface HostViewController ()<ViewPagerDataSource, ViewPagerDelegate>

  • (void)viewDidLoad { [super viewDidLoad];

    self.dataSource = self; self.delegate = self; self.arrayDays = [[DBManager sharedInstance] getUniqueDays];

    self.isTodayAvailable = [self isTodayAvailableInSchedule]; [self setupNavigationBar]; [self loadContent];

    [[SabaClient sharedInstance] showSpinner:YES]; [self getWeeklyPrograms];

    //Create the Event Store self.eventStore = [[EKEventStore alloc]init]; }

  • (NSUInteger)numberOfTabsForViewPager:(ViewPagerController *)viewPager { return self.numberOfTabs; }

  • (UIView *)viewPager:(ViewPagerController *)viewPager viewForTabAtIndex:(NSUInteger)index {

    UILabel *label = [UILabel new]; label.backgroundColor = [UIColor clearColor];

    label.font = [UIFont boldSystemFontOfSize:16.0]; label.text = [self.arrayDays objectAtIndex:index]; label.textAlignment = NSTextAlignmentCenter; label.textColor = [UIColor whiteColor]; [label sizeToFit];

    return label; }

  • (UIViewController *)viewPager:(ViewPagerController *)viewPager contentViewControllerForTabAtIndex:(NSUInteger)index { DailyProgramViewController *dailyProgramVC = [[DailyProgramViewController alloc] init]; dailyProgramVC.day = [self.arrayDays objectAtIndex:index]; return dailyProgramVC; }

Here is the link of full source code... https://github.com/aftabnaqvi/SabaApp/blob/Saba-iOS-1.2/SabaApp/HostViewController.m

I pushed the app with this code but I see crash reports but few. You can try downloading the app from this URL. https://itunes.apple.com/us/app/saba-islamic-center-shia-association/id1000687778?mt=8

Thanks for looking into it.

aftabnaqvi avatar Jan 05 '16 21:01 aftabnaqvi

I am also getting same issue when i swipe fast left to right then getting memory issue. Message from debugger: Terminated due to memory issue

developweb10 avatar Jan 03 '17 07:01 developweb10

Any one can help me to solve this issue otherwise i need to replace this library from app.

developweb10 avatar Jan 06 '17 08:01 developweb10

@developweb10 sorry man, but I do not support this library any more. You look at Pager (swift version) is a bit more reliable.

lucoceano avatar Jan 07 '17 14:01 lucoceano

@lucoceano You have any other solution for this?

developweb10 avatar Jan 12 '17 11:01 developweb10

@developweb10 if you're into swift, I've done this https://github.com/lucoceano/Pager, you check it out if fits your needs

lucoceano avatar Jan 12 '17 13:01 lucoceano