TWTRTweetView crash and issues

ios
crash
bug
twitterkit

#1

#Issue 1:
####The TweetView crash when tapping multiple times

TweetID: 863935277441531904

I disabled the open media by tapping the image/video directly by implementing the delegate methods (I will explain the reason for doing that in issue 2):

extension MyViewController: TWTRTweetViewDelegate {
    func tweetView(_ tweetView: TWTRTweetView, didTap image: UIImage, with imageURL: URL) { }
    func tweetView(_ tweetView: TWTRTweetView, didTapVideoWith videoURL: URL) { }
}

Then when I taped the image on the tweetView initialized using the tweetID I provided several times, the App crashed

2017-05-15 22:54:44.118 AppWatch[29472:15875138] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
*** First throw call stack:
(
	0   CoreFoundation                      0x02e10494 __exceptionPreprocess + 180
	1   libobjc.A.dylib                     0x08027e02 objc_exception_throw + 50
	2   CoreFoundation                      0x02cd5aa3 -[__NSArrayM objectAtIndex:] + 243
	3   CoreFoundation                      0x02d4d3b8 -[NSArray objectAtIndexedSubscript:] + 40
	4   AppWatch                            0x00f35f18 -[TWTRTweetMediaView imageAtIndex:] + 84
	5   AppWatch                            0x00f35ebc -[TWTRTweetMediaView imageForMediaEntity:] + 175
	6   AppWatch                            0x00f0315f -[TWTRTweetContentView imageForMediaEntity:] + 83
	7   AppWatch                            0x00f3199a -[TWTRTweetView allowDelegateToHandlePresentationOfImageMediaEntity:] + 175
	8   AppWatch                            0x00f31810 -[TWTRTweetView tweetMediaView:shouldPresentImageForMediaEntity:] + 80
	9   AppWatch                            0x00f36d20 -[TWTRTweetMediaView shouldPresentMediaEntity:] + 164
	10  AppWatch                            0x00f360ae -[TWTRTweetMediaView presentDetailedImageViewWithMediaEntityAtIndex:] + 160
	11  AppWatch                            0x00f35c86 -[TWTRTweetMediaView presentDetailedViewForMediaEntityAtIndex:] + 120
	12  AppWatch                            0x00f35cdc -[TWTRTweetMediaView presentDetailedMediaForGesture:] + 75
	13  UIKit                               0x059e2d04 _UIGestureRecognizerSendTargetActions + 168
	14  UIKit                               0x059debc2 _UIGestureRecognizerSendActions + 176
	15  UIKit                               0x059dc6c0 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 929
	16  UIKit                               0x059df3b3 -[UIGestureRecognizer _delayedUpdateGesture] + 60
	17  UIKit                               0x059e5cfc ___UIGestureRecognizerUpdate_block_invoke898 + 86
	18  UIKit                               0x059e5b69 _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 374
	19  UIKit                               0x059d08a2 _UIGestureRecognizerUpdate + 3407
	20  UIKit                               0x054cbefd -[UIWindow _sendGesturesForEvent:] + 1559
	21  UIKit                               0x054cd5b6 -[UIWindow sendEvent:] + 1137
	22  UIKit                               0x0546ebe8 -[UIApplication sendEvent:] + 266
	23  AppWatch                            0x008df86d __35+[FLEXKeyboardShortcutManager load]_block_invoke.108 + 1053
	24  UIKit                               0x05443769 _UIApplicationHandleEventQueue + 7795
	25  CoreFoundation                      0x02d22e5f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
	26  CoreFoundation                      0x02d18aeb __CFRunLoopDoSources0 + 523
	27  CoreFoundation                      0x02d17f08 __CFRunLoopRun + 1032
	28  CoreFoundation                      0x02d17846 CFRunLoopRunSpecific + 470
	29  CoreFoundation                      0x02d1765b CFRunLoopRunInMode + 123
	30  GraphicsServices                    0x0a0cc664 GSEventRunModal + 192
	31  GraphicsServices                    0x0a0cc4a1 GSEventRun + 104
	32  UIKit                               0x05449eb9 UIApplicationMain + 160
	33  AppWatch                            0x0008067c main + 140
	34  libdyld.dylib                       0x09429a25 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

#Issue 2:
####When tapping the media asset directly, the SDK will add a view on top of the current VC rather than using a new view controller.

In our app, we are handling different rules for interface orientation, and we want the user to be able to rotate the app to watch a video from tweet. However it would be too hard to force the interface orientation when user close the video since all the viewWillAppear/Disappear method are not called since it’s not a new VC. Is it possible the SDK would provide a delegate method similar to the one you provide when the tweet is tapped :

optional public func tweetView(_ tweetView: TWTRTweetView, shouldDisplay controller: TWTRTweetDetailViewController) -> Bool