Skip to content

Commit

Permalink
[iOS11] Fix warnings (#428)
Browse files Browse the repository at this point in the history
* [iOS11] Fix warnings

* enable ios and tvos support for PINCache

* update Changelog

* fix indention
  • Loading branch information
Eke authored and garrettmoon committed Nov 20, 2017
1 parent 8f1eed4 commit bb81222
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## master
* Add your own contributions to the next release on the line below this with your name.
- [iOS11] Fix warnings [#428](https://github.com/pinterest/PINRemoteImage/pull/428) [Eke](https://github.com/Eke)
- [new] Add support for higher frame rate devices to animated images. [#417](https://github.com/pinterest/PINRemoteImage/pull/417) [garrettmoon](https://github.com/garrettmoon)

## 3.0.0 Beta 13
Expand Down
10 changes: 6 additions & 4 deletions PINRemoteImage.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ Pod::Spec.new do |s|
end

s.subspec "PINCache" do |pc|
pc.dependency 'PINRemoteImage/Core'
pc.dependency 'PINCache', '=3.0.1-beta.6'
pc.osx.deployment_target = osx_deployment
pc.source_files = 'Source/Classes/PINCache/*.{h,m}'
pc.dependency 'PINRemoteImage/Core'
pc.dependency 'PINCache', '=3.0.1-beta.6'
pc.ios.deployment_target = ios_deployment
pc.tvos.deployment_target = tvos_deployment
pc.osx.deployment_target = osx_deployment
pc.source_files = 'Source/Classes/PINCache/*.{h,m}'
end

end
15 changes: 12 additions & 3 deletions Source/Classes/PINURLSessionManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,18 @@ - (BOOL)responseRecoverableFrom404:(NSHTTPURLResponse*)response
#if DEBUG
- (void)concurrentDownloads:(void (^_Nullable)(NSUInteger concurrentDownloads))concurrentDownloadsCompletion
{
[self.session getAllTasksWithCompletionHandler:^(NSArray<__kindof NSURLSessionTask *> * _Nonnull tasks) {
concurrentDownloadsCompletion(tasks.count);
}];
if (@available(macos 10.11, iOS 9.0, watchOS 2.0, tvOS 9.0, *)) {
[self.session getAllTasksWithCompletionHandler:^(NSArray<__kindof NSURLSessionTask *> * _Nonnull tasks) {
concurrentDownloadsCompletion(tasks.count);
}];
} else {
[self.session getTasksWithCompletionHandler:^(NSArray<NSURLSessionDataTask *> * _Nonnull dataTasks,
NSArray<NSURLSessionUploadTask *> * _Nonnull uploadTasks,
NSArray<NSURLSessionDownloadTask *> * _Nonnull downloadTasks) {
NSUInteger total = dataTasks.count + uploadTasks.count + downloadTasks.count;
concurrentDownloadsCompletion(total);
}];
}
}

#endif
Expand Down
2 changes: 1 addition & 1 deletion Tests/PINRemoteImageTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,7 @@ - (void)testMaximumNumberOfDownloads
//I want this retain cycle
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-retain-cycles"
__block void (^checkConcurrentDownloads) ();
__block void (^checkConcurrentDownloads) (void);
checkConcurrentDownloads = ^{
usleep(10000);
[self.imageManager.sessionManager concurrentDownloads:^(NSUInteger concurrentDownloads) {
Expand Down

0 comments on commit bb81222

Please sign in to comment.