Skip to content

Commit

Permalink
Fixed iOS crash issue on Swift 5.5 (#720)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhomlala authored Sep 22, 2021
1 parent 3f1637f commit c5c6b82
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 0.0.75
* Fixed iOS build issue connected with Swift 5.5.

## 0.0.74
* [BREAKING_CHANGE] `nextVideoTimeStreamController` is now marked as private. Please use `nextVideoTimeStream` to access stream.
* [BREAKING_CHANGE] Removed BackdropFilter from cupertino theme.
Expand Down
2 changes: 1 addition & 1 deletion docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

```yaml
dependencies:
better_player: ^0.0.74
better_player: ^0.0.75
```
2. Install it
Expand Down
2 changes: 1 addition & 1 deletion example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>8.0</string>
<string>9.0</string>
</dict>
</plist>
6 changes: 3 additions & 3 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -451,7 +451,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -500,7 +500,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
20 changes: 13 additions & 7 deletions ios/Classes/CachingPlayerItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,30 @@ open class CachingPlayerItem: AVPlayerItem {
guard let initialUrl = owner?.url else {
fatalError("internal inconsistency")
}
startDataRequest(with: initialUrl)
startDataRequest( url: initialUrl)
}
pendingRequests.insert(loadingRequest)
processPendingRequests()
return true
}

func startDataRequest(with url: URL) {
func startDataRequest(url: URL) {
let configuration = URLSessionConfiguration.default
configuration.requestCachePolicy = .reloadIgnoringLocalAndRemoteCacheData
session = URLSession(configuration: configuration, delegate: self, delegateQueue: nil)
var request = URLRequest(url: url)
request.httpMethod = "GET"
if let unwrappedDict = self.headers {
for (_key, _value) in unwrappedDict.enumerated() {
request.setValue((_value as! String), forHTTPHeaderField: (_key as! String))
let headersString = self.headers as? [String:AnyObject]
if let unwrappedDict = headersString {
for (headerKey,headerValue) in unwrappedDict{
guard let headerValueString = headerValue as? String
else {
continue
}
request.setValue(headerValueString, forHTTPHeaderField: headerKey)

}
}
}
session?.dataTask(with: request).resume()
}

Expand Down Expand Up @@ -182,7 +188,7 @@ open class CachingPlayerItem: AVPlayerItem {
///Starts current download.
open func download() {
if resourceLoaderDelegate.session == nil {
resourceLoaderDelegate.startDataRequest(with: url)
resourceLoaderDelegate.startDataRequest(url: url)
}
}
///Stops current download.
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: better_player
description: Advanced video player based on video_player and Chewie. It's solves many typical use cases and it's easy to run.
version: 0.0.74
version: 0.0.75
# Disabled because of warning from analyzer
# authors:
# - Jakub Homlala <jhomlala@gmail.com>
Expand Down

0 comments on commit c5c6b82

Please sign in to comment.