Closed sgraesser17 closed 1 year ago
I cannot reproduce a crash on the example project.
Replace line 205 with the following code:
I'm not sure how you are returning nil
since the function expects a non optional.
Tested my changes again with Xcode 13.4.1 on a iPhone 8 simulator running iOS 15.5. The sample app still crashes.
I am using the 5.5 release of InputBarAccessoryView. Haven't tested with release 6.0 or 6.1.
You are correct in that returning nil
will not work. It should have been returning .zero
I am attaching the changes I made to the InputBarAccessoryView files for you to compare with. Archive.zip
Does not crash for me. Please clearly list all reproduction steps.
Don't know what else to tell you. The app crashes every time for me. The index path row is 1 and the attachments array has only 1 item in it. Since showAddAttachmentCell is true, the collection view has increased in the number of items in the section by 1. But, the collection view isn't checking if the last cell in the section is for the add attachment cell. The method is automatically assuming the index path row is smaller than the attachment array size.
got the same crash. my team is using messagekit on version 3.8.0 (just updated to this version in our latest release). Now, it looks like we need to revert back to 3.7.0. the update to inputbaraccessoryview 5.5 caused this for us as well.
@mmdock 3.8.0 is quite old too, did you try 4.0.0? Any hint or idea how to repro or when it happens? Did you repro in the example project?
While trying to change the delete button (it's currently just the character x) on the attachment view (issue can be found here https://github.com/nathantannar4/InputBarAccessoryView/issues/16), I also hit this issue. Using version 6.2.0 which comes with MessageKit 4.1.1. Errored on the same line. This makes it effectively impossible to customize any of the AttachmentCells, which is a pretty major issue. I think @sgraesser17's steps to reproduce are pretty clear. Did you guys figure out a workaround @mmdock?
@monstermac77 @Kaspik @nathantannar4 still having this crash while trying to update to 6.2.0 (messagekit 4.1.1). I can't add any attachment.
the issue seems to come from
if let customSize = self.dataSource?.attachmentManager(self, sizeFor: self.attachments[indexPath.row], at: indexPath.row){
return customSize
}
it looks like the row value is 1 greater than the actual number of attachments on inspection
Thanks so much for fixing this with 6.3.0! Been working great for us.
Describe the bug My app crashes on iOS 15.5 when adding attachments when an AttachmentManager dataSource is defined
To Reproduce Add the following code to the CommonTableViewController.swift file After line 29:
After line 250
Compile and run the example app. Select the Slack row in the InputAccessoryView section Tap on the photo library button Select a photo App crashes at line 205 in AttachmentManager.swift file with a "Fatal error: Index out of range"
Expected behavior I expected the photo to be added as an attachment
Screenshots None
Environment
Additional context Replace line 205 with the following code: