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

iOS 18 crash: GiphyGridController switch from gifs -> stickers #253

Closed
AndrewSB opened this issue Sep 20, 2024 · 2 comments
Closed

iOS 18 crash: GiphyGridController switch from gifs -> stickers #253

AndrewSB opened this issue Sep 20, 2024 · 2 comments
Labels

Comments

@AndrewSB
Copy link

🐛 Bug Report

On iOS 18, there's a crash when switching the GPHMediaType. in the case where there were results for the media type you were on, and there are no results for the one you're switching to

To Reproduce

(Write your steps here:)

  1. Open a view with the GiphyGridController and perform a search for a gif with a text search term "warthog angel" (warthog angel has gif search results, but no sticker results)
  2. See gif results
  3. Switch the search to be for stickers instead of gifs, here's example code for that:
        let content =
            text.count >= 1
                ? GPHContent.search(withQuery: text, mediaType: mediaType, language: .english)
                : GPHContent.trending(mediaType: mediaType)

        currentSearchTerm = (text, mediaType)
        giphyGridController.content = content
        giphyGridController.update()

Expected behavior

show an empty result for stickers in the giphy grid

(Write what you thought would happen.)

Actual Behavior

I get the following crash

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Expected dequeued view to be returned to the collection view in preparation for display. When the collection view's data source is asked to provide a view for a given index path, ensure that a single view is dequeued and returned to the collection view. Avoid dequeuing views without a request from the collection view. For retrieving an existing view in the collection view, use -[UICollectionView cellForItemAtIndexPath:] or -[UICollectionView supplementaryViewForElementKind:atIndexPath:]. Dequeued view: <GiphyUISDK.GPHMediaCell: 0x102a06a30; baseClass = UICollectionViewCell; frame = (0 0; 377 180); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x600000072f50>; layer = <CALayer: 0x600000302e80>>; Collection view: <UICollectionView: 0x10698be00; frame = (0 0; 377 783); gestureRecognizers = <NSArray: 0x600000f496b0>; backgroundColor = UIExtendedGrayColorSpace 0 0; layer = <CALayer: 0x6000005588c0>; contentOffset: {0, -8}; contentSize: {377, 188}; adjustedContentInset: {8, 0, 0, 0}; layout: <GiphyUISDK.GPHWaterfallLayout: 0x10363b950>; dataSource: <GiphyUISDK.GiphyGridController: 0x1120e0000>>'
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001804b70ec __exceptionPreprocess + 172
	1   libobjc.A.dylib                     0x000000018008ede8 objc_exception_throw + 72
	2   Foundation                          0x0000000180e73aa8 _userInfoForFileAndLine + 0
	3   UIKitCore                           0x00000001851ae220 __43-[UICollectionView _updateVisibleCellsNow:]_block_invoke.444 + 136
	4   UIKitCore                           0x0000000185a9b60c -[_UICollectionViewSubviewManager removeAllDequeuedViewsWithEnumerator:] + 188
	5   UIKitCore                           0x00000001851adce8 -[UICollectionView _updateVisibleCellsNow:] + 4000
	6   UIKitCore                           0x00000001851b2af0 -[UICollectionView layoutSubviews] + 284
	7   UIKitCore                           0x000000018601c0c4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2404
	8   QuartzCore                          0x000000018b06ceb0 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 432
	9   QuartzCore                          0x000000018b077c34 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 124
	10  QuartzCore                          0x000000018afacc58 _ZN2CA7Context18commit_transactionEPNS_11TransactionEdPd + 464
	11  QuartzCore                          0x000000018afdb468 _ZN2CA11Transaction6commitEv + 652
	12  QuartzCore                          0x000000018afdc9bc _ZN2CA11Transaction25flush_as_runloop_observerEb + 68
	13  UIKitCore                           0x0000000185aa14dc _UIApplicationFlushCATransaction + 48
	14  UIKitCore                           0x00000001859d2944 __setupUpdateSequence_block_invoke_2 + 352
	15  UIKitCore                           0x0000000185030388 _UIUpdateSequenceRun + 76
	16  UIKitCore                           0x00000001859d22e8 schedulerStepScheduledMainSection + 168
	17  UIKitCore                           0x00000001859d1720 runloopSourceCallback + 80
	18  CoreFoundation                      0x000000018041b324 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
	19  CoreFoundation                      0x000000018041b26c __CFRunLoopDoSource0 + 172
	20  CoreFoundation                      0x000000018041a9d0 __CFRunLoopDoSources0 + 232
	21  CoreFoundation                      0x00000001804150b0 __CFRunLoopRun + 788
	22  CoreFoundation                      0x0000000180414960 CFRunLoopRunSpecific + 536
	23  GraphicsServices                    0x0000000190183b10 GSEventRunModal + 160
	24  UIKitCore                           0x0000000185aa2b40 -[UIApplication _run] + 796
	25  UIKitCore                           0x0000000185aa6d38 UIApplicationMain + 124
	26  SwiftUI                             0x00000001d1e2eab4 $s7SwiftUI17KitRendererCommon33_ACC2C5639A7D76F611E170E831FCA491LLys5NeverOyXlXpFAESpySpys4Int8VGSgGXEfU_ + 164

(Write what happened. Add screenshots, if applicable.)

Your Environment

  • Giphy iOS SDK version: 2.2.10
  • Dependency Manager: SPM
  • Xcode Version: 16
  • Swift Version: 6
  • Device info (Simulator/Device? iOS version? Debug/Release?): on debug, release, device, and simulator

Reproducible Demo

can share if it doesn't seem to reproduce. i didn't do all the work to make this a reduced example, i'm hoping it's an obvious bug that can be fixed

@AndrewSB AndrewSB added the bug Something isn't working label Sep 20, 2024
@leschlogl
Copy link

Hi @AndrewSB

Thank you for flagging this. We are working on a fix for this and should be released soon!

@leschlogl
Copy link

Hi @AndrewSB,

We just released v2.2.11 that addresses this issue.

Would you mind trying this new version?

Thank you!

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

3 participants