Skip to content
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

UICollectionReuseableView layoutAttributes unrecognized selector #29

Closed
ay8s opened this issue Apr 18, 2017 · 7 comments
Closed

UICollectionReuseableView layoutAttributes unrecognized selector #29

ay8s opened this issue Apr 18, 2017 · 7 comments
Labels

Comments

@ay8s
Copy link
Collaborator

ay8s commented Apr 18, 2017

Just updating to use Texture within Buffer. We're hitting a crash that looks to have been introduced here... 3164d8d

We're using IGListKit with Texture if that has any effect at all.

* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x00000001169de111 libobjc.A.dylib`objc_exception_throw
    frame #1: 0x000000011749c134 CoreFoundation`-[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    frame #2: 0x00000001173b3840 CoreFoundation`___forwarding___ + 1024
    frame #3: 0x00000001173b33b8 CoreFoundation`__forwarding_prep_0___ + 120
  * frame #4: 0x00000001100ad487 Buffer`::-[ASCollectionView collectionView:willDisplaySupplementaryView:forElementKind:atIndexPath:](self=0x00007ff782855a00, _cmd="collectionView:willDisplaySupplementaryView:forElementKind:atIndexPath:", collectionView=0x00007ff782855a00, view=0x00007ff781db5450, elementKind="UICollectionElementKindSectionHeader", indexPath=0xc000000000000016) at ASCollectionView.mm:1123
    frame #5: 0x000000011494a9b4 UIKit`-[UICollectionView _createPreparedSupplementaryViewForElementOfKind:atIndexPath:withLayoutAttributes:applyAttributes:] + 1724
    frame #6: 0x0000000114965425 UIKit`-[UICollectionView _viewAnimationsForCurrentUpdate] + 4595
    frame #7: 0x000000011496ac7f UIKit`__71-[UICollectionView _updateWithItems:tentativelyForReordering:animator:]_block_invoke.2012 + 197
    frame #8: 0x00000001140cfd3e UIKit`+[UIView(Animation) performWithoutAnimation:] + 90
    frame #9: 0x00000001149698b9 UIKit`-[UICollectionView _updateWithItems:tentativelyForReordering:animator:] + 3856
    frame #10: 0x0000000114963bbf UIKit`-[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:] + 17030
    frame #11: 0x000000011496c259 UIKit`-[UICollectionView _endUpdatesWithInvalidationContext:tentativelyForReordering:animator:] + 71
    frame #12: 0x000000011496c5a0 UIKit`-[UICollectionView _performBatchUpdates:completion:invalidationContext:tentativelyForReordering:animator:] + 437
    frame #13: 0x000000011496c3c8 UIKit`-[UICollectionView _performBatchUpdates:completion:invalidationContext:tentativelyForReordering:] + 91
    frame #14: 0x000000011496c34a UIKit`-[UICollectionView _performBatchUpdates:completion:invalidationContext:] + 74
    frame #15: 0x000000011496c29f UIKit`-[UICollectionView performBatchUpdates:completion:] + 53
    frame #16: 0x00000001100a6c96 Buffer`::-[ASCollectionView _superPerformBatchUpdates:completion:](self=0x00007ff782855a00, _cmd="_superPerformBatchUpdates:completion:", updates=0x00000001100b9710, completion=0x00000001100ba9c0)(), void (^)(BOOL)) at ASCollectionView.mm:779
    frame #17: 0x00000001100b95ee Buffer`::__59-[ASCollectionView rangeController:didUpdateWithChangeSet:]_block_invoke((null)=<unavailable>) at ASCollectionView.mm:1877
    frame #18: 0x00000001100b936b Buffer`ASPerformBlockWithoutAnimation(withoutAnimation=NO, block=0x00000001100b93a0) block_pointer) at ASInternalHelpers.h:78
    frame #19: 0x00000001100b91ef Buffer`::-[ASCollectionView rangeController:didUpdateWithChangeSet:](self=0x00007ff782855a00, _cmd="rangeController:didUpdateWithChangeSet:", rangeController=0x00006100002a6ae0, changeSet=0x0000610000347220) at ASCollectionView.mm:1868
    frame #20: 0x00000001101a58a5 Buffer`::-[ASRangeController dataController:didUpdateWithChangeSet:](self=0x00006100002a6ae0, _cmd="dataController:didUpdateWithChangeSet:", dataController=0x000060000010fed0, changeSet=0x0000610000347220) at ASRangeController.mm:499
    frame #21: 0x00000001100cf503 Buffer`::__40-[ASDataController updateWithChangeSet:]_block_invoke_3((null)=0x00006080006630c0) at ASDataController.mm:583
    frame #22: 0x000000011017f5b4 Buffer`::__30-[ASMainSerialQueue runBlocks]_block_invoke((null)=<unavailable>) at ASMainSerialQueue.mm:62
    frame #23: 0x0000000117fb64a6 libdispatch.dylib`_dispatch_call_block_and_release + 12
    frame #24: 0x0000000117fdf05c libdispatch.dylib`_dispatch_client_callout + 8
    frame #25: 0x0000000117fc040b libdispatch.dylib`_dispatch_main_queue_callback_4CF + 411
    frame #26: 0x00000001173f1909 CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    frame #27: 0x00000001173b7ae4 CoreFoundation`__CFRunLoopRun + 2164
    frame #28: 0x00000001173b7016 CoreFoundation`CFRunLoopRunSpecific + 406
    frame #29: 0x0000000118d9ca24 GraphicsServices`GSEventRunModal + 62
    frame #30: 0x00000001140180d4 UIKit`UIApplicationMain + 159
    frame #31: 0x000000010f973801 Buffer`main(argc=1, argv=0x00007fff502942e0) at main.m:14
    frame #32: 0x000000011802b65d libdyld.dylib`start + 1

  thread #2, queue = 'com.apple.libdispatch-manager'
    frame #0: 0x0000000118342dc6 libsystem_kernel.dylib`kevent_qos + 10
    frame #1: 0x0000000117fd0efb libdispatch.dylib`_dispatch_mgr_wait_for_event + 66
    frame #2: 0x0000000117fca872 libdispatch.dylib`_dispatch_mgr_invoke + 197
    frame #3: 0x0000000117fca6a7 libdispatch.dylib`_dispatch_mgr_thread + 54

  thread #3
    frame #0: 0x000000011834244e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x0000000118376695 libsystem_pthread.dylib`_pthread_wqthread + 1426
    frame #2: 0x00000001183760f1 libsystem_pthread.dylib`start_wqthread + 13

  thread #5
    frame #0: 0x000000011834244e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x0000000118376695 libsystem_pthread.dylib`_pthread_wqthread + 1426
    frame #2: 0x00000001183760f1 libsystem_pthread.dylib`start_wqthread + 13

  thread #6, name = 'com.apple.uikit.eventfetch-thread'
    frame #0: 0x000000011833a34a libsystem_kernel.dylib`mach_msg_trap + 10
    frame #1: 0x0000000118339797 libsystem_kernel.dylib`mach_msg + 55
    frame #2: 0x00000001173b82e4 CoreFoundation`__CFRunLoopServiceMachPort + 212
    frame #3: 0x00000001173b77a9 CoreFoundation`__CFRunLoopRun + 1337
    frame #4: 0x00000001173b7016 CoreFoundation`CFRunLoopRunSpecific + 406
    frame #5: 0x0000000112ac6480 Foundation`-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 274
    frame #6: 0x0000000112b4bae9 Foundation`-[NSRunLoop(NSRunLoop) runUntilDate:] + 87
    frame #7: 0x0000000114a88931 UIKit`-[UIEventFetcher threadMain] + 118
    frame #8: 0x0000000112ad5fb1 Foundation`__NSThread__start__ + 1197
    frame #9: 0x00000001183769af libsystem_pthread.dylib`_pthread_body + 180
    frame #10: 0x00000001183768fb libsystem_pthread.dylib`_pthread_start + 286
    frame #11: 0x0000000118376101 libsystem_pthread.dylib`thread_start + 13

  thread #7
    frame #0: 0x000000011834244e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x0000000118376695 libsystem_pthread.dylib`_pthread_wqthread + 1426
    frame #2: 0x00000001183760f1 libsystem_pthread.dylib`start_wqthread + 13

  thread #8
    frame #0: 0x000000011834244e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x0000000118376695 libsystem_pthread.dylib`_pthread_wqthread + 1426
    frame #2: 0x00000001183760f1 libsystem_pthread.dylib`start_wqthread + 13

  thread #9, name = 'com.apple.NSURLConnectionLoader'
    frame #0: 0x000000011833a34a libsystem_kernel.dylib`mach_msg_trap + 10
    frame #1: 0x0000000118339797 libsystem_kernel.dylib`mach_msg + 55
    frame #2: 0x00000001173b82e4 CoreFoundation`__CFRunLoopServiceMachPort + 212
    frame #3: 0x00000001173b77a9 CoreFoundation`__CFRunLoopRun + 1337
    frame #4: 0x00000001173b7016 CoreFoundation`CFRunLoopRunSpecific + 406
    frame #5: 0x000000011160fdff CFNetwork`+[NSURLConnection(Loader) _resourceLoadLoop:] + 406
    frame #6: 0x0000000112ad5fb1 Foundation`__NSThread__start__ + 1197
    frame #7: 0x00000001183769af libsystem_pthread.dylib`_pthread_body + 180
    frame #8: 0x00000001183768fb libsystem_pthread.dylib`_pthread_start + 286
    frame #9: 0x0000000118376101 libsystem_pthread.dylib`thread_start + 13

  thread #10, name = 'GAIThread'
    frame #0: 0x000000011833a34a libsystem_kernel.dylib`mach_msg_trap + 10
    frame #1: 0x0000000118339797 libsystem_kernel.dylib`mach_msg + 55
    frame #2: 0x00000001173b82e4 CoreFoundation`__CFRunLoopServiceMachPort + 212
    frame #3: 0x00000001173b77a9 CoreFoundation`__CFRunLoopRun + 1337
    frame #4: 0x00000001173b7016 CoreFoundation`CFRunLoopRunSpecific + 406
    frame #5: 0x0000000112ac6480 Foundation`-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 274
    frame #6: 0x0000000112ac635b Foundation`-[NSRunLoop(NSRunLoop) run] + 76
    frame #7: 0x000000010feb3cde Buffer`+[GAI threadMain:] + 62
    frame #8: 0x0000000112ad5fb1 Foundation`__NSThread__start__ + 1197
    frame #9: 0x00000001183769af libsystem_pthread.dylib`_pthread_body + 180
    frame #10: 0x00000001183768fb libsystem_pthread.dylib`_pthread_start + 286
    frame #11: 0x0000000118376101 libsystem_pthread.dylib`thread_start + 13

  thread #11, queue = 'com.apple.CoreText.MorxConversion'
    frame #0: 0x0000000112973dec CoreText`MorxLigatureSubtableBuilder::From(long, unsigned int, unsigned int, TInlineVector<std::__1::vector<unsigned short, std::__1::allocator<unsigned short> >, 30ul> const&, std::__1::__wrap_iter<LigInput*>, std::__1::__wrap_iter<LigInput*>, std::__1::vector<unsigned short, std::__1::allocator<unsigned short> > const&) + 1102
    frame #1: 0x0000000112978197 CoreText`MorxTableBuilder::From(TFont const&, OTL::GCommon::Header const*, void const*, OTFeaturesMap&) + 8899
    frame #2: 0x000000011297a456 CoreText`ConvertGSUBToMorxInternal(TFont const&, __CFData const*) + 1170
    frame #3: 0x00000001128c3fe6 CoreText`___Z18ConvertToMorxAsyncPK8__CTFont_block_invoke + 80
    frame #4: 0x0000000117fb64a6 libdispatch.dylib`_dispatch_call_block_and_release + 12
    frame #5: 0x0000000117fdf05c libdispatch.dylib`_dispatch_client_callout + 8
    frame #6: 0x0000000117fbd94f libdispatch.dylib`_dispatch_queue_serial_drain + 221
    frame #7: 0x0000000117fbe669 libdispatch.dylib`_dispatch_queue_invoke + 1084
    frame #8: 0x0000000117fc0ec4 libdispatch.dylib`_dispatch_root_queue_drain + 634
    frame #9: 0x0000000117fc0bef libdispatch.dylib`_dispatch_worker_thread3 + 123
    frame #10: 0x0000000118376616 libsystem_pthread.dylib`_pthread_wqthread + 1299
    frame #11: 0x00000001183760f1 libsystem_pthread.dylib`start_wqthread + 13

  thread #12
    frame #0: 0x000000011834244e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x0000000118376695 libsystem_pthread.dylib`_pthread_wqthread + 1426
    frame #2: 0x00000001183760f1 libsystem_pthread.dylib`start_wqthread + 13

  thread #13
    frame #0: 0x000000011834244e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x0000000118376695 libsystem_pthread.dylib`_pthread_wqthread + 1426
    frame #2: 0x00000001183760f1 libsystem_pthread.dylib`start_wqthread + 13

  thread #14
    frame #0: 0x000000011834244e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x0000000118376695 libsystem_pthread.dylib`_pthread_wqthread + 1426
    frame #2: 0x00000001183760f1 libsystem_pthread.dylib`start_wqthread + 13

  thread #15, name = 'com.squareup.SocketRocket.NetworkThread'
    frame #0: 0x000000011833a34a libsystem_kernel.dylib`mach_msg_trap + 10
    frame #1: 0x0000000118339797 libsystem_kernel.dylib`mach_msg + 55
    frame #2: 0x00000001173b82e4 CoreFoundation`__CFRunLoopServiceMachPort + 212
    frame #3: 0x00000001173b77a9 CoreFoundation`__CFRunLoopRun + 1337
    frame #4: 0x00000001173b7016 CoreFoundation`CFRunLoopRunSpecific + 406
    frame #5: 0x0000000112ac6480 Foundation`-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 274
    frame #6: 0x000000011003243e Buffer`-[_SRRunLoopThread main](self=0x000060800009b2b0, _cmd="main") at SRWebSocket.m:1903
    frame #7: 0x0000000112ad5fb1 Foundation`__NSThread__start__ + 1197
    frame #8: 0x00000001183769af libsystem_pthread.dylib`_pthread_body + 180
    frame #9: 0x00000001183768fb libsystem_pthread.dylib`_pthread_start + 286
    frame #10: 0x0000000118376101 libsystem_pthread.dylib`thread_start + 13

  thread #16, name = 'com.apple.CFSocket.private'
    frame #0: 0x0000000118341eb6 libsystem_kernel.dylib`__select + 10
    frame #1: 0x00000001173ee6d9 CoreFoundation`__CFSocketManager + 665
    frame #2: 0x00000001183769af libsystem_pthread.dylib`_pthread_body + 180
    frame #3: 0x00000001183768fb libsystem_pthread.dylib`_pthread_start + 286
    frame #4: 0x0000000118376101 libsystem_pthread.dylib`thread_start + 13

  thread #17
    frame #0: 0x000000011834244e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x0000000118376695 libsystem_pthread.dylib`_pthread_wqthread + 1426
    frame #2: 0x00000001183760f1 libsystem_pthread.dylib`start_wqthread + 13

  thread #18
    frame #0: 0x000000011834244e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x0000000118376695 libsystem_pthread.dylib`_pthread_wqthread + 1426
    frame #2: 0x00000001183760f1 libsystem_pthread.dylib`start_wqthread + 13

  thread #19
    frame #0: 0x000000011834244e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x0000000118376695 libsystem_pthread.dylib`_pthread_wqthread + 1426
    frame #2: 0x00000001183760f1 libsystem_pthread.dylib`start_wqthread + 13

  thread #20
    frame #0: 0x000000011834244e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x0000000118376695 libsystem_pthread.dylib`_pthread_wqthread + 1426
    frame #2: 0x00000001183760f1 libsystem_pthread.dylib`start_wqthread + 13

  thread #21
    frame #0: 0x000000011834244e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x0000000118376695 libsystem_pthread.dylib`_pthread_wqthread + 1426
    frame #2: 0x00000001183760f1 libsystem_pthread.dylib`start_wqthread + 13

  thread #22
    frame #0: 0x000000011834244e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x0000000118376695 libsystem_pthread.dylib`_pthread_wqthread + 1426
    frame #2: 0x00000001183760f1 libsystem_pthread.dylib`start_wqthread + 13

  thread #23
    frame #0: 0x000000011834244e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x0000000118376695 libsystem_pthread.dylib`_pthread_wqthread + 1426
    frame #2: 0x00000001183760f1 libsystem_pthread.dylib`start_wqthread + 13

  thread #24
    frame #0: 0x000000011834244e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x0000000118376695 libsystem_pthread.dylib`_pthread_wqthread + 1426
    frame #2: 0x00000001183760f1 libsystem_pthread.dylib`start_wqthread + 13

  thread #25, name = 'com.squareup.SocketRocket.NetworkThread'
    frame #0: 0x000000011833a34a libsystem_kernel.dylib`mach_msg_trap + 10
    frame #1: 0x0000000118339797 libsystem_kernel.dylib`mach_msg + 55
    frame #2: 0x00000001173b82e4 CoreFoundation`__CFRunLoopServiceMachPort + 212
    frame #3: 0x00000001173b77a9 CoreFoundation`__CFRunLoopRun + 1337
    frame #4: 0x00000001173b7016 CoreFoundation`CFRunLoopRunSpecific + 406
    frame #5: 0x0000000112ac6480 Foundation`-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 274
    frame #6: 0x0000000113df6a63 Smooch`-[_SKTSRRunLoopThread main] + 283
    frame #7: 0x0000000112ad5fb1 Foundation`__NSThread__start__ + 1197
    frame #8: 0x00000001183769af libsystem_pthread.dylib`_pthread_body + 180
    frame #9: 0x00000001183768fb libsystem_pthread.dylib`_pthread_start + 286
    frame #10: 0x0000000118376101 libsystem_pthread.dylib`thread_start + 13
@Adlai-Holler
Copy link
Member

@ay8s I wonder why plain-old UICollectionReusableViews are coming into the picture for you. Are you intending to use supplementary views? Since IGListAdapter implements the flow layout methods, it may be introducing them and returning plain views without your expectation.

@ay8s
Copy link
Collaborator Author

ay8s commented Apr 19, 2017

@Adlai-Holler We have section headers which split sections by date. In our ASCollectionSectionController we have implemented... nodeBlockForSupplementaryElementOfKind:atIndex: and returning ASCellNodes within the blocks.

@garrettmoon
Copy link
Member

@ay8s FYI, I think this is fixed by #40

@ay8s
Copy link
Collaborator Author

ay8s commented Apr 19, 2017

Thanks @garrettmoon. Updated to master but still seeing the same issue occurring. cc @plarson.

@Adlai-Holler
Copy link
Member

@ay8s Could you put a conditional breakpoint in -[UICollectionReusableView initWithFrame:], with the condition that [self class] == [UICollectionReusableView class] and see who is creating a plain-old UICollectionReusableView and what the backtrace is?

@DreamingInBinary
Copy link

@Adlai-Holler I couldn't seem to hit that using a symbolic breakpoint. If I take this code out, we don't crash (though, that breakpoint still never hits):

if (view.layoutAttributes == nil) {
    view.layoutAttributes = [collectionView 
 layoutAttributesForSupplementaryElementOfKind:elementKind atIndexPath:indexPath];
}

That's odd as initWithFrame: is a designated initializer (I don't hit initWithCoder: either but that was just a sanity check). My backtrace looks the same as @ay8s' above. I hit a few other methods off of UICollectionReusableView just to see if I could catch anything, but they were all unrelated to Texture and were part of another container controller that uses a vanilla collection view.

@ay8s
Copy link
Collaborator Author

ay8s commented May 1, 2017

Figured this one out, sorry for not catching this one sooner. We had the following...

- (__kindof UICollectionReusableView *)viewForSupplementaryElementOfKind:(NSString *)elementKind atIndex:(NSInteger)index { \
    return [self.collectionContext dequeueReusableSupplementaryViewOfKind:elementKind forSectionController:self class:[UICollectionReusableView class] atIndex:index];
}

Rather than...

- (__kindof UICollectionReusableView *)viewForSupplementaryElementOfKind:(NSString *)elementKind atIndex:(NSInteger)index {
  return [ASIGListSupplementaryViewSourceMethods viewForSupplementaryElementOfKind:elementKind atIndex:index sectionController:self];
}

Closing this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants