Closed joshgare closed 4 years ago
Looking at you stack trace it seems like video
may be nil
in
completion(true, Video(xcdVideo: video), nil)
The guard above checks if error
is not nil
but doesn't check if video is not nil
Hi @pigeon,
Thanks for the heads up but my initialiser for Video allows for video to be nil so I don't think it's that, that is causing the problem.
init?(xcdVideo: XCDYouTubeVideo?) {
guard let streamUrl = xcdVideo?.streamURL.absoluteString, let xcdVideo = xcdVideo else { return nil }
...
I have truncated the rest of my model initialiser as it's quite large and isn't relevant to the issue.
I see. another thing I can think about is that streamURL
is nil
. AFAIR
@property (nonatomic, readonly) NSURL *streamURL;
would be bridged into an implicitly unwrapped optional and it would cause a crash if it's nil
.
I haven't come across this property before and use streamURLs
dictionary in my code. I then check if HD720
exists and if it does not I fall back to whatever is available.
I see. another thing I can think about is that
streamURL
isnil
. AFAIR@property (nonatomic, readonly) NSURL *streamURL;
would be bridged into an implicitly unwrapped optional and it would cause a crash if it's
nil
.I haven't come across this property before and use
streamURLs
dictionary in my code. I then check ifHD720
exists and if it does not I fall back to whatever is available.
Thanks for spotting this, I figured that streamURL
could never be nil
because of the YouTube API. I will add the appropriate nullability annotation.
Hi,
First of all thanks for a great library 🎉
Secondly, my firebase crash reporting occasionally reported a crash being caused by XCDYouTubeKit on the main thread. It's probably something I am doing wrong but I wanted to writ euphorias an issue to see if anyone could help me fix the problem / bring attention if it is a wider problem.
Stack trace:
Line 380 in Video.swift where is xcdVideo is of type XCDYouTubeVideo:
Video is initialised like so:
Any help would be greatly appreciated!