Compare commits
238 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
53837dc070 | |
|
|
c012fc9bb2 | |
|
|
67329ac512 | |
|
|
de149aedaa | |
|
|
fc0de57066 | |
|
|
473054879c | |
|
|
5d42a2ac5e | |
|
|
1e412927cc | |
|
|
eab4279140 | |
|
|
1bf62d475a | |
|
|
d8dc6a25aa | |
|
|
335a437b2e | |
|
|
cb7a3db23c | |
|
|
6545a3aba1 | |
|
|
9137b65d3b | |
|
|
09a9e74eae | |
|
|
5580c78282 | |
|
|
af7b587936 | |
|
|
86fc47bf7b | |
|
|
e6e5c5156b | |
|
|
cc510a6a4e | |
|
|
0dc2c41112 | |
|
|
f8a7b6bac7 | |
|
|
8e300c92a4 | |
|
|
44eac986bb | |
|
|
afaf306222 | |
|
|
5ac4e308c7 | |
|
|
f1a471e93f | |
|
|
11840d1313 | |
|
|
1f165b48ee | |
|
|
edb4bc3554 | |
|
|
990f85bce2 | |
|
|
b40124c95d | |
|
|
371533549c | |
|
|
d4d11ef0b0 | |
|
|
d6d9a5c233 | |
|
|
1fba8d99f3 | |
|
|
5cc5abae03 | |
|
|
19041b44c2 | |
|
|
d2b648e8ff | |
|
|
29c9c5d68a | |
|
|
4709774dc2 | |
|
|
0979d5b5f7 | |
|
|
11521aa040 | |
|
|
83240bd781 | |
|
|
32787175ac | |
|
|
0da78a4ce6 | |
|
|
09556f2d21 | |
|
|
ed7df926ea | |
|
|
16e1862afc | |
|
|
1ef791bad9 | |
|
|
32ca18b523 | |
|
|
1189f74c00 | |
|
|
469d8bbfd8 | |
|
|
2489074417 | |
|
|
b39fab3180 | |
|
|
974141f5a2 | |
|
|
e7fa11058b | |
|
|
8fe7ed5ca7 | |
|
|
cbb50e986e | |
|
|
68ae502797 | |
|
|
6e1b2aa8f0 | |
|
|
9c4fcfa844 | |
|
|
e41af47e2f | |
|
|
070cbc63ee | |
|
|
3b039d5910 | |
|
|
64f621081c | |
|
|
b426975b9f | |
|
|
fca618fb61 | |
|
|
9ecf488aff | |
|
|
a8fca6584f | |
|
|
47115e2593 | |
|
|
6a623cd58f | |
|
|
a45b222e70 | |
|
|
aa3598f3e0 | |
|
|
8aca4ca1b3 | |
|
|
cac21e106d | |
|
|
ee49d49d35 | |
|
|
6c650f910e | |
|
|
e709a04e89 | |
|
|
ee50027b88 | |
|
|
740cd7f090 | |
|
|
95468315fc | |
|
|
40ad58571b | |
|
|
30e9e0b516 | |
|
|
11c7efb6e1 | |
|
|
a090531604 | |
|
|
f9abff8988 | |
|
|
92e38160d6 | |
|
|
8dcc5b5ae7 | |
|
|
2b57abd44a | |
|
|
6b5f3236a8 | |
|
|
c8c00810dd | |
|
|
04a0431ae9 | |
|
|
ac98896099 | |
|
|
6406d8e526 | |
|
|
5b05d6c3cc | |
|
|
53ef2dc3c3 | |
|
|
0e4dbe1f24 | |
|
|
32923fa2e8 | |
|
|
dcb7985c5c | |
|
|
3b9c09142a | |
|
|
07fe1f0dfe | |
|
|
4068b93386 | |
|
|
0ecd13667d | |
|
|
7ba8208f17 | |
|
|
bf899e222f | |
|
|
c1f6aecd8b | |
|
|
782c682187 | |
|
|
233b6c2607 | |
|
|
65fbc3b85a | |
|
|
eec1b67497 | |
|
|
a16d007622 | |
|
|
577fefa26e | |
|
|
7a48ca6dad | |
|
|
20c77af44c | |
|
|
5f0594f043 | |
|
|
2d748f1e2f | |
|
|
944fd77965 | |
|
|
3af1a30ebb | |
|
|
996fea9e5b | |
|
|
6a28dc7ae9 | |
|
|
7e6bd60176 | |
|
|
b185621812 | |
|
|
05ce156764 | |
|
|
4786e98605 | |
|
|
60cab8b74c | |
|
|
14842f65f7 | |
|
|
4d1abffb32 | |
|
|
46c59183aa | |
|
|
6814af4ade | |
|
|
5a5c65d799 | |
|
|
d00d368cdb | |
|
|
49f6e532b5 | |
|
|
5f6287e535 | |
|
|
c011d1a88b | |
|
|
6edface2c3 | |
|
|
0df58e4995 | |
|
|
fb62c3fde1 | |
|
|
a45c722fc8 | |
|
|
25b4c178d9 | |
|
|
be560a4090 | |
|
|
df751e737b | |
|
|
a9ea132874 | |
|
|
c68d585e49 | |
|
|
4cfb12c01c | |
|
|
dcde40fc01 | |
|
|
ae11cf7e43 | |
|
|
0373b97f71 | |
|
|
5c7dc8c2e5 | |
|
|
ba335fc7d5 | |
|
|
33c13e79ca | |
|
|
f611d5e52b | |
|
|
4d6693c813 | |
|
|
ef578240b3 | |
|
|
d107a80189 | |
|
|
b111d6246a | |
|
|
511ce9992e | |
|
|
48d4adc210 | |
|
|
7e160e34a2 | |
|
|
466e4011d0 | |
|
|
08e9962b5e | |
|
|
7692bd2610 | |
|
|
2ee4bfe24b | |
|
|
8021ddd313 | |
|
|
db4f3fc9b6 | |
|
|
4499441661 | |
|
|
e622b290c9 | |
|
|
0e761f4aa7 | |
|
|
43115af147 | |
|
|
01a5cfb86b | |
|
|
ef1a1c3c47 | |
|
|
5d2963ac73 | |
|
|
26698f9da0 | |
|
|
48d10c1773 | |
|
|
1f65ca773f | |
|
|
dfc57ac94c | |
|
|
8f3b5e9330 | |
|
|
be0791233c | |
|
|
8f309e194e | |
|
|
d7bc2c0036 | |
|
|
737140d4cb | |
|
|
91b4251115 | |
|
|
393d4f1601 | |
|
|
78be42ee3b | |
|
|
4756d5dcbe | |
|
|
a51688168d | |
|
|
98989d9524 | |
|
|
f72f4c183d | |
|
|
9f719ca2f9 | |
|
|
79eb6e77c5 | |
|
|
66ddb23593 | |
|
|
9ae8f97425 | |
|
|
38a6edb02a | |
|
|
7e50d78c80 | |
|
|
704c630567 | |
|
|
4dd5a6681a | |
|
|
6690de8ccf | |
|
|
9c00f5cd7b | |
|
|
a897811eb5 | |
|
|
a66a790eb2 | |
|
|
17a4803661 | |
|
|
70dfe15144 | |
|
|
f2252b3499 | |
|
|
9620fffa64 | |
|
|
4f97897a41 | |
|
|
cd0c57f43e | |
|
|
c0c5e0d714 | |
|
|
2b68869927 | |
|
|
d56c4f3d22 | |
|
|
eac0b816f8 | |
|
|
85dde52173 | |
|
|
88ee3c6774 | |
|
|
6e947240a0 | |
|
|
7f99c01804 | |
|
|
72ed897c53 | |
|
|
843148139b | |
|
|
fb2063086d | |
|
|
beabb1842b | |
|
|
0ef0e07f77 | |
|
|
27e3038ec3 | |
|
|
210c13d124 | |
|
|
021607a845 | |
|
|
9ee89474ed | |
|
|
f83abb578a | |
|
|
4445bb2e47 | |
|
|
6468a92f32 | |
|
|
dadb740c47 | |
|
|
ce73619640 | |
|
|
0e047941e9 | |
|
|
761b00553b | |
|
|
22750a18b2 | |
|
|
f7a2321107 | |
|
|
d90d115893 | |
|
|
327c444322 | |
|
|
cd977d70a4 | |
|
|
dad2a9254b | |
|
|
9af7460f2b |
|
|
@ -0,0 +1,42 @@
|
|||
# Contributing to SDWebImage
|
||||
|
||||
We want to make contributing to this project as easy and transparent as possible. Here are a few guidelines for making all our lives easier.
|
||||
|
||||
## Asking questions
|
||||
|
||||
We don't use GitHub as a support forum. For any usage questions that are not specific to the project itself, please ask on [Stack Overflow](https://stackoverflow.com/) instead. By doing so, you'll be more likely to quickly solve your problem, and you'll allow anyone else with the same question to find the answer. This also allows maintainers to focus on improving the project for others.
|
||||
|
||||
## Reporting Issues
|
||||
|
||||
A great way to contribute to the project is to send a detailed issue when you encounter an problem.
|
||||
It is very important to check for the same problem or suggestion in the project's issue list first. If you find a match, just add a small comment there.
|
||||
Doing this helps prioritize the most common problems and requests.
|
||||
|
||||
When reporting issues, please include the following:
|
||||
|
||||
- The platform name and version (e.g. iOS 8.1)
|
||||
- The library version
|
||||
- The integration method (e.g. CocoaPods/Carthage/manually)
|
||||
- The version of Xcode you're using
|
||||
- The full output of any stack trace or compiler error
|
||||
- A small demo project that replicates the issue (especially if the way to reproduce the issue is not straight-forward)
|
||||
- Any other details that would be useful in understanding the problem
|
||||
|
||||
This information will help us review and fix your issue faster.
|
||||
|
||||
|
||||
Please do not be offended if we close your issue and reference this document.
|
||||
If you believe the issue is truely a fault in the project’s codebase, re-open it.
|
||||
|
||||
## Pull Requests
|
||||
|
||||
We gladly accept any PR's assuming they are well written, documented ( if necessary ) and preferably have test code.
|
||||
If you're unsure if we'll accept a new feature please open an issue requesting it and we can have a discussion before you code and submit a PR.
|
||||
|
||||
Checklist:
|
||||
- Fork the repo and create your branch from the latest master (to minimize the conflicts)
|
||||
- If you've added code that should be tested, add tests.
|
||||
- If you've changed APIs, update the documentation.
|
||||
- Ensure the test suite passes.
|
||||
- Make sure your code lints (pod lib lint)
|
||||
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
### New Issue Checklist
|
||||
|
||||
* [ ] I have read and understood the [CONTRIBUTING guide](https://github.com/rs/SDWebImage/blob/master/.github/CONTRIBUTING.md)
|
||||
* [ ] I have read the [Documentation](http://cocoadocs.org/docsets/SDWebImage/)
|
||||
* [ ] I have searched for a similar issue in the [project](https://github.com/rs/SDWebImage/issues) and found none
|
||||
|
||||
### Issue Info
|
||||
|
||||
Info | Value |
|
||||
-------------------------|-------------------------------------|
|
||||
Platform Name | e.g. ios / tvos
|
||||
Platform Version | e.g. 8.0
|
||||
SDWebImage Version | e.g. 3.7.6
|
||||
Integration Method | e.g. carthage / cocoapods / manually
|
||||
Xcode Version | e.g. Xcode 7.3
|
||||
Repro rate | e.g. all the time (100%) / sometimes x% / only once
|
||||
Repro with our demo prj | e.g. does it happen with our demo project?
|
||||
Demo project link | e.g. link to a demo project that highlights the issue
|
||||
|
||||
### Issue Description and Steps
|
||||
|
||||
Please fill in the detailed description of the issue (full output of any stack trace, compiler error, ...) and the steps to reproduce the issue.
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
### New Pull Request Checklist
|
||||
|
||||
* [ ] I have read and understood the [CONTRIBUTING guide](https://github.com/rs/SDWebImage/blob/master/.github/CONTRIBUTING.md)
|
||||
* [ ] I have read the [Documentation](http://cocoadocs.org/docsets/SDWebImage/)
|
||||
* [ ] I have searched for a similar pull request in the [project](https://github.com/rs/SDWebImage/pulls) and found none
|
||||
|
||||
* [ ] I have updated this branch with the latest master to avoid conflicts (via merge from master or rebase)
|
||||
* [ ] I have added the required tests to prove the fix/feature I am adding
|
||||
* [ ] I have updated the documentation (if necesarry)
|
||||
* [ ] I have run the tests and they pass
|
||||
* [ ] I have run the lint and it passes (`pod lib lint`)
|
||||
|
||||
This merge request fixes / reffers to the following issues: ...
|
||||
|
||||
### Pull Request Description
|
||||
|
||||
...
|
||||
|
||||
|
|
@ -18,6 +18,7 @@ DerivedData
|
|||
*.hmap
|
||||
*.ipa
|
||||
*.xcuserstate
|
||||
*.xcscmblueprint
|
||||
|
||||
# CocoaPods
|
||||
#
|
||||
|
|
@ -26,4 +27,4 @@ DerivedData
|
|||
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
|
||||
#
|
||||
Pods/
|
||||
Podfile.lock
|
||||
Podfile.lock
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
[submodule "Vendors/libwebp"]
|
||||
path = Vendors/libwebp
|
||||
url = http://git.chromium.org/webm/libwebp.git
|
||||
url = https://github.com/webmproject/libwebp
|
||||
|
|
|
|||
17
.travis.yml
17
.travis.yml
|
|
@ -1,24 +1,27 @@
|
|||
|
||||
language: objective-c
|
||||
|
||||
osx_image: xcode7.1
|
||||
|
||||
before_install:
|
||||
|
||||
- export LANG=en_US.UTF-8
|
||||
- env
|
||||
- locale
|
||||
- gem install cocoapods --quiet
|
||||
- gem install cocoapods --no-rdoc --no-ri --no-document --quiet
|
||||
- pod --version
|
||||
- pod setup --silent
|
||||
- pod setup --silent > /dev/null
|
||||
- pod repo update --silent
|
||||
|
||||
script:
|
||||
|
||||
- pod lib lint --allow-warnings
|
||||
- xctool -workspace SDWebImage.xcworkspace -scheme 'SDWebImage' -sdk iphonesimulator -arch i386 build
|
||||
- xctool -workspace SDWebImage.xcworkspace -scheme 'SDWebImage+WebP' -sdk iphonesimulator -arch i386 build
|
||||
- xctool -workspace SDWebImage.xcworkspace -scheme 'SDWebImage+MKAnnotation' -sdk iphonesimulator -arch i386 build
|
||||
- xctool -workspace SDWebImage.xcworkspace -scheme 'SDWebImage' -sdk iphonesimulator build
|
||||
- xctool -workspace SDWebImage.xcworkspace -scheme 'SDWebImage+WebP' -sdk iphonesimulator build
|
||||
- xctool -workspace SDWebImage.xcworkspace -scheme 'SDWebImage+MKAnnotation' -sdk iphonesimulator build
|
||||
|
||||
- xctool -workspace SDWebImage.xcworkspace -scheme 'SDWebImage Demo' -sdk iphonesimulator -arch i386 build
|
||||
- xctool -workspace SDWebImage.xcworkspace -scheme 'SDWebImage Demo' -sdk iphonesimulator build
|
||||
|
||||
- pod install --project-directory=Tests
|
||||
- xcodebuild -workspace SDWebImage.xcworkspace -scheme 'Tests' -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' test
|
||||
- xctool -workspace SDWebImage.xcworkspace -scheme 'SDWebImage' -sdk iphonesimulator clean
|
||||
- xctool -workspace SDWebImage.xcworkspace -scheme 'Tests' -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' test
|
||||
|
|
@ -0,0 +1,283 @@
|
|||
## [3.8.1 Patch release for 3.8.0 on Jun 7th, 2016](https://github.com/rs/SDWebImage/releases/tag/3.8.1)
|
||||
|
||||
#### Fixes:
|
||||
|
||||
- SDWebImage 3.8.0 get wrong image #1589 - the issue was caused by the changes in 3.8.0 (Removed the URL query params from the filename (key) fb0cdb6d 1bf62d4 #1584 - fixes #1433 #1553 #1583 #1585) - Reverted.
|
||||
- Note: The solution for those issues (i.e. #1433 #1553) is to set the `SDWebImageManager` `cacheKeyFilter` block and do their own calculations there.
|
||||
|
||||
## [3.8.0 Minor release - Replaces NSURLConnection (deprecated) with NSURLSession - on Jun 6th, 2016](https://github.com/rs/SDWebImage/releases/tag/3.8.0)
|
||||
|
||||
#### Infrastructure:
|
||||
|
||||
- Had to update the iOS deployment target to 7.0 from 5 - 6545a3a
|
||||
|
||||
#### Features:
|
||||
|
||||
- Replace deprecated `NSURLConnection` with `NSURLSession` #1578 #1586 - fixes #1291 #1318 #823 #1566 #1515
|
||||
- Allow to customise cache and image downloader instances used with `SDWebImageManager` 86fc47bf7b - fixes #1398 #870
|
||||
|
||||
#### Fixes:
|
||||
|
||||
- Removed the URL query params from the filename (key) fb0cdb6d 1bf62d4 #1584 - fixes #1433 #1553 #1583 #1585
|
||||
- Fixed the WebP build with the official 1.0.0 CocoaPods release f1a471e - fixes #1444
|
||||
- Updated doc: `removeImageForKey:` not synchronous e6e5c51 - fixes #1379 #1415
|
||||
|
||||
## [3.7.6 Patch release for 3.7.0 on May 8th, 2016](https://github.com/rs/SDWebImage/releases/tag/3.7.6)
|
||||
|
||||
#### Infrastructure:
|
||||
- Changed the **libwebp git url** so that people from China can access it - #1390 (from `https://chromium.googlesource.com/webm/libwebp` to `https://github.com/webmproject/libwebp`)
|
||||
|
||||
#### Features:
|
||||
- Added `cancelAllDownloads` method to `SDWebImageDownloader` #1504
|
||||
- Added API to save image `NSData` to disk cache: `[SDImageCache storeImageDataToDisk:forKey:]` #1453
|
||||
|
||||
#### Fixes:
|
||||
- Fix #1449: Version 3.7.5 breaks semantic versioning (removes public API). Re-added `sd_setImageWithPreviousCachedImageWithURL:andPlaceholderImage:options:progress:completed:` and deprecated it. Will remove it in 4.0.0 b40124c
|
||||
- Fix `CGContextDrawImage: invalid context 0x0` - #1496 (fixes #1401 #1454 #1457)
|
||||
- Fix `CGBitmapContextCreateImage: invalid context 0x0` - #1464 (fixes #1423)
|
||||
- Fix changed image size when loading from disk #1540 (fixes #1437)
|
||||
- Repair memory release in the iPad environment #1549 (had to switch `#if TARGET_OS_IPHONE` to `#if TARGET_OS_IOS`)
|
||||
- Fixed completion logic in `MKAnnotationView+WebCache` #1547
|
||||
- Optimize the decoder to avoid unwanted blended layer - #1527 (fixes #1524)
|
||||
- Protect against malformed frame for GIFs - #1447
|
||||
- updated doc: #1462 #1466 #1486 #1532 #1461
|
||||
|
||||
## [3.7.5 Patch release for 3.7.0 on Jan 21st, 2016](https://github.com/rs/SDWebImage/releases/tag/3.7.5)
|
||||
- fixed #1425 and #1426 - Continuation of Fix #1366, addresses #1350 and reverts a part of #1221 - from commit 6406d8e, the wrong usage of `dispatch_apply`
|
||||
- fixed #1422 - Added a fallback for #976 so that if there are images saved with the old format (no extension), they can still be loaded
|
||||
|
||||
## [3.7.4 Patch release for 3.7.0 with tvOS support on Jan 8th, 2016](https://github.com/rs/SDWebImage/releases/tag/3.7.4)
|
||||
|
||||
#### Updates
|
||||
- bumped `libwep` version to `0.4.4`
|
||||
|
||||
#### Features:
|
||||
- added tvOS support #1327 and #1358 - fix #1368 and #1302
|
||||
|
||||
#### Fixes:
|
||||
- #1217 contains several of the above fixes
|
||||
- fix #391 -> option to cache only on Disk. will replace #1130
|
||||
- fix #343 -> iCloud backup Option
|
||||
- fix #371 -> CGBitmapContextCreate: unsupported parameter combination + #1268 #1412 #1340
|
||||
- fix #576 -> scale set to screen scale
|
||||
- fix #1035 -> progress queue with dispatch_async
|
||||
- new feature -> activity indicator using auto layout. The activity indicator feature will replace #131
|
||||
- #1218 progress callbacks now report on main thread - fixes #1035
|
||||
- #1321 Added a new constructor to SDWebImagePrefetcher - replaces #956
|
||||
- #976 append the original path extension to the hash filename - fixes #967
|
||||
- replaced #999 with #1221
|
||||
- added cache tests #1125
|
||||
- #1236 fixes #1203
|
||||
- bf899e2 fixes #1261 #1263 compilation issue CocoaPods vs non-CocoaPods
|
||||
- #1367 fixes a bug where image scale & orientation are ignored when decoding / decompressing an image
|
||||
- cac21e1 fixes #1366, addresses #1350 and reverts a part of #1221 - from commit 6406d8e, the wrong usage of dispatch_apply
|
||||
- #1363 fixes #1361 sd_cancelBackgroundImageLoadForState
|
||||
- #1348 Create a strong ref of weakOperation in the entry of The image download subOperation, use the strong ref instead weakOperation. At the same time, repair some logic of the 'If cancelled'
|
||||
- dcb7985 replaces #1345 - Load local credential file
|
||||
- #1323 don't to perform download if url is "" but not nil
|
||||
- #1310 Added support for SDWebImageAvoidAutoSetImage option to UIButton and highlighted UIImageView categories
|
||||
- #1308 Added Swift installation tips
|
||||
- 32923fa Xcode 7.1 updates
|
||||
- #1297 cleaner implementation of failedUrl error handling - fixes #1275
|
||||
- #1280 Fix sd_animatedImageByScalingAndCroppingToSize
|
||||
- Remove logging from the image prefetcher - #1276
|
||||
- Fix typos #1256 #1257 #1258 #1331 #1290
|
||||
|
||||
## [3.7.3 Patch release for 3.7.0 with iOS8+ framework and Carthage on Jun 13th, 2015](https://github.com/rs/SDWebImage/releases/tag/3.7.3)
|
||||
|
||||
- Adds support for **iOS 8+ Framework and Carthage** [#1071](https://github.com/rs/SDWebImage/pull/1071) [#1081](https://github.com/rs/SDWebImage/pull/1081) [#1101](https://github.com/rs/SDWebImage/pull/1101)
|
||||
|
||||
- [Refactor] Use `NSMutableSet` for failed URLs' storage instead of array [#1076](https://github.com/rs/SDWebImage/pull/1076)
|
||||
- Make a constant for the error domain [#1011](https://github.com/rs/SDWebImage/pull/1011)
|
||||
- Improve operation behavior [#988](https://github.com/rs/SDWebImage/pull/988)
|
||||
- Bug fix: `Collection <__NSArrayM: > was mutated while being enumerated` [#985](https://github.com/rs/SDWebImage/pull/985)
|
||||
- added `SDWebImageAvoidAutoSetImage` option to avoid automatic image addition in `UIImageView` and let developer to do it himself [#1188](https://github.com/rs/SDWebImage/pull/1188)
|
||||
- Added support for custom disk cache folder with fall back for caches directory [#1153](https://github.com/rs/SDWebImage/pull/1153)
|
||||
- Added some files to the workspace so they are easier to edit [8431481](https://github.com/rs/SDWebImage/commit/8431481)
|
||||
- Doc update [72ed897](https://github.com/rs/SDWebImage/commit/72ed897) [7f99c01](https://github.com/rs/SDWebImage/commit/7f99c01) [#1016](https://github.com/rs/SDWebImage/pull/1016) [#1038](https://github.com/rs/SDWebImage/pull/1038) [#1045](https://github.com/rs/SDWebImage/pull/1045)
|
||||
- [Memory Issue] Clear `SDWebImagePrefetcher` `progressBlock` when it has completed [#1017](https://github.com/rs/SDWebImage/pull/1017)
|
||||
- avoid warning `<Error>: ImageIO: CGImageSourceCreateWithData data parameter is nil` if `imageData` is nil [88ee3c6](https://github.com/rs/SDWebImage/commit/88ee3c6) [#1018](https://github.com/rs/SDWebImage/pull/1018)
|
||||
- allow override `diskCachePath` [#1041](https://github.com/rs/SDWebImage/pull/1041)
|
||||
- Use `__typeof(self)` when assigning `weak` reference for block [#1054](https://github.com/rs/SDWebImage/pull/1054)
|
||||
- [Refactor] Implement cache cost calculation as a inline function [#1075](https://github.com/rs/SDWebImage/pull/1075)
|
||||
- @3x support [9620fff](https://github.com/rs/SDWebImage/commit/9620fff) [#1005](https://github.com/rs/SDWebImage/pull/1005)
|
||||
- Fix parenthesis to avoid crashes [#1104](https://github.com/rs/SDWebImage/pull/1104)
|
||||
- Add `NSCache` countLimit property [#1140](https://github.com/rs/SDWebImage/pull/1140)
|
||||
- `failedURLs` can be removed at the appropriate time [#1111](https://github.com/rs/SDWebImage/pull/1111)
|
||||
- Purge `NSCache` on system memory notifications [#1143](https://github.com/rs/SDWebImage/pull/1143)
|
||||
- Determines at runtime is `UIApplication` is available as per [#1082](https://github.com/rs/SDWebImage/issues/1082) [#1085](https://github.com/rs/SDWebImage/pull/1085)
|
||||
- Fixes http://git.chromium.org/webm/libwebp.git/info/refs not valid [#1175](https://github.com/rs/SDWebImage/pull/1175) + Reverted [#1193](https://github.com/rs/SDWebImage/pull/1193) + [#1177](https://github.com/rs/SDWebImage/pull/1177)
|
||||
- 404 image url was causing the test to fail [0e761f4](https://github.com/rs/SDWebImage/commit/0e761f4)
|
||||
- Fix for transparency being lost in transformed images. [#1121](https://github.com/rs/SDWebImage/pull/1121)
|
||||
- Add handling for additional error codes that shouldn't be considered a permanent failure [#1159](https://github.com/rs/SDWebImage/pull/1159)
|
||||
- add webp accepted content type only if `WebP` enabled [#1178](https://github.com/rs/SDWebImage/pull/1178)
|
||||
- fix `ImageIO: CGImageSourceCreateWithData` data parameter is nil [#1167](https://github.com/rs/SDWebImage/pull/1167)
|
||||
- Applied patch for issue [#1074](https://github.com/rs/SDWebImage/issues/1074) SDWebImage residing in swift module breaks the debugger [#1138](https://github.com/rs/SDWebImage/pull/1138)
|
||||
- Fixed URLs with trailing parameters get assigned an incorrect image scale value [#1157](https://github.com/rs/SDWebImage/issues/1157) [#1158](https://github.com/rs/SDWebImage/pull/1158)
|
||||
- Add newline to avoid compiler warning in `WebImage.h` [#1199](https://github.com/rs/SDWebImage/pull/1199)
|
||||
|
||||
## [3.7.2 Updated patch release for 3.7.0 on Mar 17th, 2015](https://github.com/rs/SDWebImage/releases/tag/3.7.2)
|
||||
|
||||
#### Updates
|
||||
- bumped `libwep` version to `0.4.3`
|
||||
|
||||
#### Features:
|
||||
- implement `SDWebImageDownloaderAllowInvalidSSLCertificates` option - [#937](https://github.com/rs/SDWebImage/pull/937)
|
||||
- flag to transform animated images (`SDWebImageTransformAnimatedImage`) - [#703](https://github.com/rs/SDWebImage/pull/703)
|
||||
- allows user to override default `SDWebImageDownloaderOperation` - [#876](https://github.com/rs/SDWebImage/pull/876)
|
||||
- adds option to decompress images and select prefetcher queue - [#996](https://github.com/rs/SDWebImage/pull/996)
|
||||
|
||||
#### Fixes:
|
||||
- fixed [#809](https://github.com/rs/SDWebImage/issues/809) `cancelAll` crash - [#838](https://github.com/rs/SDWebImage/pull/838)
|
||||
- fixed [#900](https://github.com/rs/SDWebImage/issues/900) by adding a new flag `SD_LOG_NONE` that allows silencing the SD logs from the Prefetcher
|
||||
- fixed [#895](https://github.com/rs/SDWebImage/issues/895) unsafe setImage in `setImageWithURL:` - [#896](https://github.com/rs/SDWebImage/pull/896)
|
||||
- fix `NSNotificationCenter` dispatch on subthreads - [#987](https://github.com/rs/SDWebImage/pull/987)
|
||||
- fix `SDWebImageDownloader` threading issue - [#104](https://github.com/rs/SDWebImage/pull/104)6
|
||||
- fixed duplicate failed urls are added into `failedURLs` - [#994](https://github.com/rs/SDWebImage/pull/994)
|
||||
- increased default `maxConcurrentOperationCount`, fixes [#527](https://github.com/rs/SDWebImage/issues/527) - [#897](https://github.com/rs/SDWebImage/pull/897)
|
||||
- handle empty urls `NSArray` - [#929](https://github.com/rs/SDWebImage/pull/929)
|
||||
- decoding webp, depends on source image data alpha status - [#936](https://github.com/rs/SDWebImage/pull/936)
|
||||
- fix [#610](https://github.com/rs/SDWebImage/issues/610) display progressive jpeg issue - [#840](https://github.com/rs/SDWebImage/pull/840)
|
||||
- the code from `SDWebImageDownloaderOperation connection:didFailWithError:` should match the code from `connectionDidFinishLoading:`. This fixes [#872](https://github.com/rs/SDWebImage/issues/872) - [7f39e5e](https://github.com/rs/SDWebImage/commit/7f39e5e)
|
||||
- `304 - Not Modified` HTTP status code handling - [#942](https://github.com/rs/SDWebImage/pull/942)
|
||||
- cost compute fix - [#941](https://github.com/rs/SDWebImage/pull/941)
|
||||
- initialise `kPNGSignatureData` data - [#981](https://github.com/rs/SDWebImage/pull/981)
|
||||
|
||||
#### Documentation
|
||||
- documentation updated
|
||||
|
||||
## [3.7.1 Patch release for 3.7.0 on Jul 23rd, 2014](https://github.com/rs/SDWebImage/releases/tag/3.7.1)
|
||||
|
||||
- fixed `sd_imageOrientationFromImageData:` crash if imageSource is nil - [#819](https://github.com/rs/SDWebImage/pull/819) [#813](https://github.com/rs/SDWebImage/pull/813) [#808](https://github.com/rs/SDWebImage/issues/808) [#828](https://github.com/rs/SDWebImage/issues/828) - temporary fix
|
||||
- fixed `SDWebImageCombinedOperation cancel` crash (also visible as `SDWebImageManager cancelAll`) - [28109c4](https://github.com/rs/SDWebImage/commit/28109c4) [#798](https://github.com/rs/SDWebImage/issues/798) [#809](https://github.com/rs/SDWebImage/issues/809)
|
||||
- fixed duplicate symbols when using with webp via pods - [#795](https://github.com/rs/SDWebImage/pull/795)
|
||||
- fixed missing `mark` from `pragma mark` - [#827](https://github.com/rs/SDWebImage/pull/827)
|
||||
|
||||
## [3.7.0 Xcode6, arm64, highlight UIImageView, imageURL ref, NTLM, ... on Jul 14th, 2014](https://github.com/rs/SDWebImage/releases/tag/3.7.0)
|
||||
|
||||
## Features
|
||||
- Add category for imageView's highlighted state `UIImageView+HighlightedWebCache` - [#646](https://github.com/rs/SDWebImage/pull/646) [#765](https://github.com/rs/SDWebImage/pull/765)
|
||||
- Keep a reference to the image URL - [#560](https://github.com/rs/SDWebImage/pull/560)
|
||||
- Pass imageURL in completedBlock - [#770](https://github.com/rs/SDWebImage/pull/770)
|
||||
- Implemented NTLM auth support. Replaced deprecated auth challenge methods from `NSURLConnectionDelegate` - [#711](https://github.com/rs/SDWebImage/pull/711) [50c4d1d](https://github.com/rs/SDWebImage/commit/50c4d1d)
|
||||
- Ability to suspend image downloaders `SDWebImageDownloader setSuspended:` - [#734](https://github.com/rs/SDWebImage/pull/734)
|
||||
- Delay the loading of the placeholder image until after load - [#701](https://github.com/rs/SDWebImage/pull/701)
|
||||
- Ability to save images to cache directly - [#714](https://github.com/rs/SDWebImage/pull/714)
|
||||
- Support for image orientation - [#764](https://github.com/rs/SDWebImage/pull/764)
|
||||
- Added async `SDImageCache removeImageForKey:withCompletion:` - [#732](https://github.com/rs/SDWebImage/pull/732) [cd4b925](https://github.com/rs/SDWebImage/commit/cd4b925)
|
||||
- Exposed cache paths - [#339](https://github.com/rs/SDWebImage/issues/339)
|
||||
- Exposed `SDWebImageManager cacheKeyForURL:` - [5fd21e5](https://github.com/rs/SDWebImage/commit/5fd21e5)
|
||||
- Exposing `SDWebImageManager` instance from the `SDWebImagePrefetcher` class - [6c409cd](https://github.com/rs/SDWebImage/commit/6c409cd)
|
||||
- `SDWebImageManager` uses the shared instance of `SDWebImageDownloader` - [0772019](https://github.com/rs/SDWebImage/commit/0772019)
|
||||
- Refactor the cancel logic - [#771](https://github.com/rs/SDWebImage/pull/771) [6d01e80](https://github.com/rs/SDWebImage/commit/6d01e80) [23874cd](https://github.com/rs/SDWebImage/commit/23874cd) [a6f11b3](https://github.com/rs/SDWebImage/commit/a6f11b3)
|
||||
- Added method `SDWebImageManager cachedImageExistsForURL:` to check if an image exists in either the disk OR the memory cache - [#644](https://github.com/rs/SDWebImage/pull/644)
|
||||
- Added option to use the cached image instead of the placeholder for `UIImageView`. Replaces [#541](https://github.com/rs/SDWebImage/pull/541) - [#599](https://github.com/rs/SDWebImage/issues/599) [30f6726](https://github.com/rs/SDWebImage/commit/30f6726)
|
||||
- Created workspace + added unit tests target
|
||||
- Updated documentation - [#476](https://github.com/rs/SDWebImage/issues/476) [#384](https://github.com/rs/SDWebImage/issues/384) [#526](https://github.com/rs/SDWebImage/issues/526) [#376](https://github.com/rs/SDWebImage/pull/376) [a8f5627](https://github.com/rs/SDWebImage/commit/a8f5627)
|
||||
|
||||
## Bugfixes
|
||||
- Fixed Xcode 6 builds - [#741](https://github.com/rs/SDWebImage/pull/741) [0b47342](https://github.com/rs/SDWebImage/commit/0b47342)
|
||||
- Fixed `diskImageExistsWithKey:` deadlock - [#625](https://github.com/rs/SDWebImage/issues/625) [6e4fbaf](https://github.com/rs/SDWebImage/commit/6e4fbaf)
|
||||
For consistency, added async methods in `SDWebImageManager` `cachedImageExistsForURL:completion:` and `diskImageExistsForURL:completion:`
|
||||
- Fixed race condition that causes cancellation of one download operation to stop a run loop that is now used for another download operation. Race is introduced through `performSelector:onThread:withObject:waitUntilDone:` - [#698](https://github.com/rs/SDWebImage/pull/698)
|
||||
- Fixed race condition between operation cancelation and loading finish - [39db378](https://github.com/rs/SDWebImage/commit/39db378) [#621](https://github.com/rs/SDWebImage/pull/621) [#783](https://github.com/rs/SDWebImage/pull/783)
|
||||
- Fixed race condition in SDWebImageManager if one operation is cancelled - [f080e38](https://github.com/rs/SDWebImage/commit/f080e38) [#699](https://github.com/rs/SDWebImage/pull/699)
|
||||
- Fixed issue where cancelled operations aren't removed from `runningOperations` - [#68](https://github.com/rs/SDWebImage/issues/68)
|
||||
- Should not add url to failedURLs when timeout, cancel and so on - [#766](https://github.com/rs/SDWebImage/pull/766) [#707](https://github.com/rs/SDWebImage/issues/707)
|
||||
- Fixed potential *object mutated while being enumerated* crash - [#727](https://github.com/rs/SDWebImage/pull/727) [#728](https://github.com/rs/SDWebImage/pull/728) (revert a threading fix from [#727](https://github.com/rs/SDWebImage/pull/727))
|
||||
- Fixed `NSURLConnection` response statusCode not valid (e.g. 404), downloader never stops its runloop and hangs the operation queue - [#735](https://github.com/rs/SDWebImage/pull/735)
|
||||
- Fixed `SDWebImageRefreshCached` bug for large images - [#744](https://github.com/rs/SDWebImage/pull/744)
|
||||
- Added proper handling for `SDWebImageDownloaderLowPriority` - [#713](https://github.com/rs/SDWebImage/issues/713) [#745](https://github.com/rs/SDWebImage/issues/745)
|
||||
- Fixed fixing potential bug when sending a nil url for UIButton+WebCache - [#761](https://github.com/rs/SDWebImage/issues/761) [#763](https://github.com/rs/SDWebImage/pull/763)
|
||||
- Fixed issue [#529](https://github.com/rs/SDWebImage/pull/529) - if the `cacheKeyFilter` was set, this was ignored when computing the `scaledImageForKey`. For most of the developers that did not set `cacheKeyFilter`, the code will work exactly the same - [eb91fdd](https://github.com/rs/SDWebImage/commit/eb91fdd)
|
||||
- Returning error in setImage completedBlock if the url was nil. Added `dispatch_main_async_safe` macro - [#505](https://github.com/rs/SDWebImage/issues/505) [af3e4f8](https://github.com/rs/SDWebImage/commit/af3e4f8)
|
||||
- Avoid premature completion of prefetcher if request fails - [#751](https://github.com/rs/SDWebImage/pull/751)
|
||||
- Return nil from `SDScaledImageForKey` if the input image is nil - [#365](https://github.com/rs/SDWebImage/issues/365) [#750](https://github.com/rs/SDWebImage/pull/750)
|
||||
- Do not load placeholder image if `SDWebImageDelayPlaceholder` option specified - [#780](https://github.com/rs/SDWebImage/pull/780)
|
||||
- Make sure we call the `startPrefetchingAtIndex:` method from main queue - [#694](https://github.com/rs/SDWebImage/pull/694)
|
||||
- Save image in cache before calling completion block - [#700](https://github.com/rs/SDWebImage/pull/700)
|
||||
- Fixed arm64 warnings - [#685](https://github.com/rs/SDWebImage/pull/685) [#720](https://github.com/rs/SDWebImage/pull/720) [#721](https://github.com/rs/SDWebImage/pull/721) [#687](https://github.com/rs/SDWebImage/pull/687)
|
||||
- Improved logging - [#721](https://github.com/rs/SDWebImage/pull/721)
|
||||
- Added `SDWebImageCompat.m` to `SDWebImage+MKAnnotation` target
|
||||
|
||||
## [3.6 Fix and cleanup on Mar 24th, 2014](https://github.com/rs/SDWebImage/releases/tag/3.6)
|
||||
|
||||
## [3.5.4 ARM64 Support on Feb 24th, 2014](https://github.com/rs/SDWebImage/releases/tag/3.5.4)
|
||||
|
||||
## [3.5.3 on Jan 7th, 2014](https://github.com/rs/SDWebImage/releases/tag/3.5.3)
|
||||
|
||||
## [3.5.2 on Jan 2nd, 2014](https://github.com/rs/SDWebImage/releases/tag/3.5.2)
|
||||
|
||||
## [3.5.1 on Dec 3rd, 2013](https://github.com/rs/SDWebImage/releases/tag/3.5.1)
|
||||
|
||||
## [3.5 WebP Target, iOS 7, Fixes on Oct 4th, 2013](https://github.com/rs/SDWebImage/releases/tag/3.5)
|
||||
|
||||
- Fix iOS 7 related issues
|
||||
- Move `WebP` support to a dedicated target
|
||||
- Removed strong reference to `UIImageView` which was causing a crash in the nested block
|
||||
- Fix timeout issue
|
||||
- Add some methods that allow to check if an image exists on disk without taking it off disk and decompressing it first
|
||||
|
||||
## [3.4 Animated image category, bug fixes on Aug 13th, 2013](https://github.com/rs/SDWebImage/releases/tag/3.4)
|
||||
|
||||
- Add `calculateSizeWithCompletionBlock`
|
||||
- Add multiple download of images for animationImages property of `UIImageView`
|
||||
- Add background task for disk cleanup [#306](https://github.com/rs/SDWebImage/issues/306)
|
||||
- Fix dead thread issue on iOS 5 [#444](https://github.com/rs/SDWebImage/pull/444), [#399](https://github.com/rs/SDWebImage/issues/399), [#466](https://github.com/rs/SDWebImage/issues/466)
|
||||
- Make IO operations cancelable to fix perf issue with heavy images [#462](https://github.com/rs/SDWebImage/issues/462)
|
||||
- Fix crash `Collection <__NSArrayM: ...> was mutated while being enumerated.` [#471](https://github.com/rs/SDWebImage/pull/471)
|
||||
|
||||
## [3.3 WebP, Animated GIF and more on Jun 14th, 2013](https://github.com/rs/SDWebImage/releases/tag/3.3)
|
||||
|
||||
- WebP image format support [#410](https://github.com/rs/SDWebImage/issues/410)
|
||||
- Animated GIF support [#375](https://github.com/rs/SDWebImage/pull/375)
|
||||
- Custom image cache search paths [#156](https://github.com/rs/SDWebImage/pull/156)
|
||||
- Bug fixes
|
||||
|
||||
## [3.2 Bug fixes on Mar 13th, 2013](https://github.com/rs/SDWebImage/releases/tag/3.2)
|
||||
|
||||
- `SDWebImageRefreshCached` download option [#326](https://github.com/rs/SDWebImage/pull/326)
|
||||
- New `SDWebImageManager` delegate methods [ebd63a88c1](https://github.com/rs/SDWebImage/commit/ebd63a88c116ac7acfbeded5c84d0fffa2443438)
|
||||
- Fix long standing issue with alpha en JPEGs [#299](https://github.com/rs/SDWebImage/pull/299)
|
||||
- Add synchronous disk-cache loading method [#297](https://github.com/rs/SDWebImage/pull/297)
|
||||
- Fix `SDWebImageCacheMemoryOnly` flag
|
||||
- Bug fixes
|
||||
|
||||
## [3.1 Bug fixes on Jan 21st, 2013](https://github.com/rs/SDWebImage/releases/tag/3.1)
|
||||
|
||||
## [3.0 Complete rewrite on Nov 29th, 2012](https://github.com/rs/SDWebImage/releases/tag/3.0)
|
||||
|
||||
- Complete rewrite of the library using `GCD`, `ARC`, `NSCache` and blocks
|
||||
- Drop compatibility with iOS 3 and 4
|
||||
|
||||
## [2.7.4 Bug fixes on Nov 14th, 2012](https://github.com/rs/SDWebImage/releases/tag/2.7.4)
|
||||
|
||||
## [2.7.3 on Nov 3rd, 2012](https://github.com/rs/SDWebImage/releases/tag/2.7.3)
|
||||
|
||||
## [2.7.2 on Oct 23rd, 2012](https://github.com/rs/SDWebImage/releases/tag/2.7.2)
|
||||
|
||||
## [2.7.1 on Oct 19th, 2012](https://github.com/rs/SDWebImage/releases/tag/2.7.1)
|
||||
|
||||
## [2.7 on Sep 8th, 2012](https://github.com/rs/SDWebImage/releases/tag/2.7)
|
||||
|
||||
## [2.6 on May 4th, 2012](https://github.com/rs/SDWebImage/releases/tag/2.6)
|
||||
|
||||
## [2.5 on Mar 22nd, 2012](https://github.com/rs/SDWebImage/releases/tag/2.5)
|
||||
|
||||
## [2.4 on Oct 1st, 2011](https://github.com/rs/SDWebImage/releases/tag/2.4)
|
||||
|
||||
## [2.3 on Sep 16th, 2010](https://github.com/rs/SDWebImage/releases/tag/2.3)
|
||||
|
||||
## [2.2 on Aug 29th, 2010](https://github.com/rs/SDWebImage/releases/tag/2.2)
|
||||
|
||||
## [2.1.0 on Jun 12th, 2010](https://github.com/rs/SDWebImage/releases/tag/2.1.0)
|
||||
|
||||
## [2.1 on Jun 12th, 2010](https://github.com/rs/SDWebImage/releases/tag/2.1)
|
||||
|
||||
## [2.0.0 on Jun 9th, 2010](https://github.com/rs/SDWebImage/releases/tag/2.0.0)
|
||||
|
||||
## [2.0 on Jun 9th, 2010](https://github.com/rs/SDWebImage/releases/tag/2.0)
|
||||
|
||||
## [1.0.0 on Dec 31st, 2009](https://github.com/rs/SDWebImage/releases/tag/1.0.0)
|
||||
|
||||
## [1.0 on Dec 31st, 2009](https://github.com/rs/SDWebImage/releases/tag/1.0)
|
||||
|
|
@ -26,6 +26,20 @@
|
|||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
43A0FAAE1BDD16AC00B7582B /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = DA248D6C1954841D00390AB0 /* SDWebImage.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 4A2CADFF1AB4BB5300B6BC39;
|
||||
remoteInfo = WebImage;
|
||||
};
|
||||
43AEAFA91D008FEE005B41A8 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = DA248D6C1954841D00390AB0 /* SDWebImage.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 00733A4C1BC487C000A5A117;
|
||||
remoteInfo = "WebImage tvOS";
|
||||
};
|
||||
DA248D731954841D00390AB0 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = DA248D6C1954841D00390AB0 /* SDWebImage.xcodeproj */;
|
||||
|
|
@ -157,6 +171,8 @@
|
|||
DA248D741954841D00390AB0 /* libSDWebImage.a */,
|
||||
DA248D761954841D00390AB0 /* libSDWebImage+WebP.a */,
|
||||
DA248D781954841D00390AB0 /* libSDWebImage+MKAnnotation.a */,
|
||||
43A0FAAF1BDD16AC00B7582B /* WebImage.framework */,
|
||||
43AEAFAA1D008FEE005B41A8 /* WebImage.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -187,7 +203,7 @@
|
|||
5376128C155AB74D005750A4 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0500;
|
||||
LastUpgradeCheck = 0710;
|
||||
ORGANIZATIONNAME = Dailymotion;
|
||||
};
|
||||
buildConfigurationList = 5376128F155AB74D005750A4 /* Build configuration list for PBXProject "SDWebImage Demo" */;
|
||||
|
|
@ -214,6 +230,20 @@
|
|||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXReferenceProxy section */
|
||||
43A0FAAF1BDD16AC00B7582B /* WebImage.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = WebImage.framework;
|
||||
remoteRef = 43A0FAAE1BDD16AC00B7582B /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
43AEAFAA1D008FEE005B41A8 /* WebImage.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = WebImage.framework;
|
||||
remoteRef = 43AEAFA91D008FEE005B41A8 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
DA248D741954841D00390AB0 /* libSDWebImage.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
|
|
@ -294,6 +324,7 @@
|
|||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = "compiler-default";
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
|
|
@ -306,7 +337,7 @@
|
|||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
};
|
||||
|
|
@ -324,7 +355,7 @@
|
|||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
|
||||
SDKROOT = iphoneos;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
|
|
@ -348,6 +379,7 @@
|
|||
INFOPLIST_FILE = "SDWebImage Demo/SDWebImage Demo-Info.plist";
|
||||
OTHER_CFLAGS = "";
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.dailymotion.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
|
|
@ -369,6 +401,7 @@
|
|||
);
|
||||
INFOPLIST_FILE = "SDWebImage Demo/SDWebImage Demo-Info.plist";
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.dailymotion.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#import "DetailViewController.h"
|
||||
|
||||
@interface MasterViewController () {
|
||||
NSArray *_objects;
|
||||
NSMutableArray *_objects;
|
||||
}
|
||||
@end
|
||||
|
||||
|
|
@ -35,311 +35,17 @@
|
|||
[SDWebImageManager sharedManager].imageDownloader.username = @"httpwatch";
|
||||
[SDWebImageManager sharedManager].imageDownloader.password = @"httpwatch01";
|
||||
|
||||
_objects = [NSArray arrayWithObjects:
|
||||
_objects = [NSMutableArray arrayWithObjects:
|
||||
@"http://www.httpwatch.com/httpgallery/authentication/authenticatedimage/default.aspx?0.35786508303135633", // requires HTTP auth, used to demo the NTLM auth
|
||||
@"http://assets.sbnation.com/assets/2512203/dogflops.gif",
|
||||
@"http://www.ioncannon.net/wp-content/uploads/2011/06/test2.webp",
|
||||
@"http://www.ioncannon.net/wp-content/uploads/2011/06/test9.webp",
|
||||
@"http://static2.dmcdn.net/static/video/656/177/44771656:jpeg_preview_small.jpg?20120509154705",
|
||||
@"http://static2.dmcdn.net/static/video/629/228/44822926:jpeg_preview_small.jpg?20120509181018",
|
||||
@"http://static2.dmcdn.net/static/video/116/367/44763611:jpeg_preview_small.jpg?20120509101749",
|
||||
@"http://static2.dmcdn.net/static/video/340/086/44680043:jpeg_preview_small.jpg?20120509180118",
|
||||
@"http://static2.dmcdn.net/static/video/666/645/43546666:jpeg_preview_small.jpg?20120412153140",
|
||||
@"http://static2.dmcdn.net/static/video/771/577/44775177:jpeg_preview_small.jpg?20120509183230",
|
||||
@"http://static2.dmcdn.net/static/video/810/508/44805018:jpeg_preview_small.jpg?20120508125339",
|
||||
@"http://static2.dmcdn.net/static/video/152/008/44800251:jpeg_preview_small.jpg?20120508103336",
|
||||
@"http://static2.dmcdn.net/static/video/694/741/35147496:jpeg_preview_small.jpg?20120508111445",
|
||||
@"http://static2.dmcdn.net/static/video/988/667/44766889:jpeg_preview_small.jpg?20120508130425",
|
||||
@"http://static2.dmcdn.net/static/video/282/467/44764282:jpeg_preview_small.jpg?20120507130637",
|
||||
@"http://static2.dmcdn.net/static/video/754/657/44756457:jpeg_preview_small.jpg?20120507093012",
|
||||
@"http://static2.dmcdn.net/static/video/831/107/44701138:jpeg_preview_small.jpg?20120506133917",
|
||||
@"http://static2.dmcdn.net/static/video/411/057/44750114:jpeg_preview_small.jpg?20120507014914",
|
||||
@"http://static2.dmcdn.net/static/video/894/547/44745498:jpeg_preview_small.jpg?20120509183004",
|
||||
@"http://static2.dmcdn.net/static/video/082/947/44749280:jpeg_preview_small.jpg?20120507015022",
|
||||
@"http://static2.dmcdn.net/static/video/833/347/44743338:jpeg_preview_small.jpg?20120509183004",
|
||||
@"http://static2.dmcdn.net/static/video/683/666/44666386:jpeg_preview_small.jpg?20120505111208",
|
||||
@"http://static2.dmcdn.net/static/video/595/946/44649595:jpeg_preview_small.jpg?20120507194104",
|
||||
@"http://static2.dmcdn.net/static/video/984/935/44539489:jpeg_preview_small.jpg?20120501184650",
|
||||
@"http://static2.dmcdn.net/static/video/440/416/44614044:jpeg_preview_small.jpg?20120505174152",
|
||||
@"http://static2.dmcdn.net/static/video/561/977/20779165:jpeg_preview_small.jpg?20120423161805",
|
||||
@"http://static2.dmcdn.net/static/video/104/546/44645401:jpeg_preview_small.jpg?20120507185246",
|
||||
@"http://static2.dmcdn.net/static/video/671/636/44636176:jpeg_preview_small.jpg?20120504021339",
|
||||
@"http://static2.dmcdn.net/static/video/142/746/44647241:jpeg_preview_small.jpg?20120504104451",
|
||||
@"http://static2.dmcdn.net/static/video/776/860/44068677:jpeg_preview_small.jpg?20120507185251",
|
||||
@"http://static2.dmcdn.net/static/video/026/626/44626620:jpeg_preview_small.jpg?20120503203036",
|
||||
@"http://static2.dmcdn.net/static/video/364/663/39366463:jpeg_preview_small.jpg?20120509163505",
|
||||
@"http://static2.dmcdn.net/static/video/392/895/44598293:jpeg_preview_small.jpg?20120503165252",
|
||||
@"http://static2.dmcdn.net/static/video/620/865/44568026:jpeg_preview_small.jpg?20120507185121",
|
||||
@"http://static2.dmcdn.net/static/video/031/395/44593130:jpeg_preview_small.jpg?20120507185139",
|
||||
@"http://static2.dmcdn.net/static/video/676/495/44594676:jpeg_preview_small.jpg?20120503121341",
|
||||
@"http://static2.dmcdn.net/static/video/025/195/44591520:jpeg_preview_small.jpg?20120503132132",
|
||||
@"http://static2.dmcdn.net/static/video/993/665/44566399:jpeg_preview_small.jpg?20120503182623",
|
||||
@"http://static2.dmcdn.net/static/video/137/635/44536731:jpeg_preview_small.jpg?20120501165940",
|
||||
@"http://static2.dmcdn.net/static/video/611/794/44497116:jpeg_preview_small.jpg?20120507184954",
|
||||
@"http://static2.dmcdn.net/static/video/732/790/44097237:jpeg_preview_small.jpg?20120430162348",
|
||||
@"http://static2.dmcdn.net/static/video/064/991/44199460:jpeg_preview_small.jpg?20120430101250",
|
||||
@"http://static2.dmcdn.net/static/video/404/094/44490404:jpeg_preview_small.jpg?20120507184948",
|
||||
@"http://static2.dmcdn.net/static/video/413/120/44021314:jpeg_preview_small.jpg?20120507180850",
|
||||
@"http://static2.dmcdn.net/static/video/200/584/44485002:jpeg_preview_small.jpg?20120507184941",
|
||||
@"http://static2.dmcdn.net/static/video/551/318/42813155:jpeg_preview_small.jpg?20120412153202",
|
||||
@"http://static2.dmcdn.net/static/video/524/750/44057425:jpeg_preview_small.jpg?20120501220912",
|
||||
@"http://static2.dmcdn.net/static/video/124/843/44348421:jpeg_preview_small.jpg?20120507184551",
|
||||
@"http://static2.dmcdn.net/static/video/496/394/42493694:jpeg_preview_small.jpg?20120430105337",
|
||||
@"http://static2.dmcdn.net/static/video/548/883/44388845:jpeg_preview_small.jpg?20120428212713",
|
||||
@"http://static2.dmcdn.net/static/video/282/533/44335282:jpeg_preview_small.jpg?20120427102844",
|
||||
@"http://static2.dmcdn.net/static/video/257/132/44231752:jpeg_preview_small.jpg?20120428212609",
|
||||
@"http://static2.dmcdn.net/static/video/480/193/44391084:jpeg_preview_small.jpg?20120501143214",
|
||||
@"http://static2.dmcdn.net/static/video/903/432/44234309:jpeg_preview_small.jpg?20120427200002",
|
||||
@"http://static2.dmcdn.net/static/video/646/573/44375646:jpeg_preview_small.jpg?20120507184652",
|
||||
@"http://static2.dmcdn.net/static/video/709/573/44375907:jpeg_preview_small.jpg?20120507184652",
|
||||
@"http://static2.dmcdn.net/static/video/885/633/44336588:jpeg_preview_small.jpg?20120507184540",
|
||||
@"http://static2.dmcdn.net/static/video/732/523/44325237:jpeg_preview_small.jpg?20120426110308",
|
||||
@"http://static2.dmcdn.net/static/video/935/132/44231539:jpeg_preview_small.jpg?20120426115744",
|
||||
@"http://static2.dmcdn.net/static/video/941/129/43921149:jpeg_preview_small.jpg?20120426094640",
|
||||
@"http://static2.dmcdn.net/static/video/775/942/44249577:jpeg_preview_small.jpg?20120425011228",
|
||||
@"http://static2.dmcdn.net/static/video/868/332/44233868:jpeg_preview_small.jpg?20120429152901",
|
||||
@"http://static2.dmcdn.net/static/video/959/732/44237959:jpeg_preview_small.jpg?20120425133534",
|
||||
@"http://static2.dmcdn.net/static/video/383/402/44204383:jpeg_preview_small.jpg?20120424185842",
|
||||
@"http://static2.dmcdn.net/static/video/971/932/44239179:jpeg_preview_small.jpg?20120424154419",
|
||||
@"http://static2.dmcdn.net/static/video/096/991/44199690:jpeg_preview_small.jpg?20120423162001",
|
||||
@"http://static2.dmcdn.net/static/video/661/450/44054166:jpeg_preview_small.jpg?20120507180921",
|
||||
@"http://static2.dmcdn.net/static/video/419/322/44223914:jpeg_preview_small.jpg?20120424112858",
|
||||
@"http://static2.dmcdn.net/static/video/673/391/44193376:jpeg_preview_small.jpg?20120507181450",
|
||||
@"http://static2.dmcdn.net/static/video/907/781/44187709:jpeg_preview_small.jpg?20120423103507",
|
||||
@"http://static2.dmcdn.net/static/video/446/571/44175644:jpeg_preview_small.jpg?20120423033122",
|
||||
@"http://static2.dmcdn.net/static/video/146/671/44176641:jpeg_preview_small.jpg?20120428235503",
|
||||
@"http://static2.dmcdn.net/static/video/463/571/44175364:jpeg_preview_small.jpg?20120428235503",
|
||||
@"http://static2.dmcdn.net/static/video/442/471/44174244:jpeg_preview_small.jpg?20120428235502",
|
||||
@"http://static2.dmcdn.net/static/video/523/471/44174325:jpeg_preview_small.jpg?20120422205107",
|
||||
@"http://static2.dmcdn.net/static/video/977/159/43951779:jpeg_preview_small.jpg?20120420182100",
|
||||
@"http://static2.dmcdn.net/static/video/875/880/40088578:jpeg_preview_small.jpg?20120501131026",
|
||||
@"http://static2.dmcdn.net/static/video/434/992/38299434:jpeg_preview_small.jpg?20120503193356",
|
||||
@"http://static2.dmcdn.net/static/video/448/798/42897844:jpeg_preview_small.jpg?20120418155203",
|
||||
@"http://static2.dmcdn.net/static/video/374/690/44096473:jpeg_preview_small.jpg?20120507181124",
|
||||
@"http://static2.dmcdn.net/static/video/284/313/43313482:jpeg_preview_small.jpg?20120420184511",
|
||||
@"http://static2.dmcdn.net/static/video/682/060/44060286:jpeg_preview_small.jpg?20120421122436",
|
||||
@"http://static2.dmcdn.net/static/video/701/750/44057107:jpeg_preview_small.jpg?20120420112918",
|
||||
@"http://static2.dmcdn.net/static/video/790/850/44058097:jpeg_preview_small.jpg?20120424114522",
|
||||
@"http://static2.dmcdn.net/static/video/153/617/43716351:jpeg_preview_small.jpg?20120419190650",
|
||||
@"http://static2.dmcdn.net/static/video/394/633/37336493:jpeg_preview_small.jpg?20111109151109",
|
||||
@"http://static2.dmcdn.net/static/video/893/330/44033398:jpeg_preview_small.jpg?20120419123322",
|
||||
@"http://static2.dmcdn.net/static/video/395/046/42640593:jpeg_preview_small.jpg?20120418103546",
|
||||
@"http://static2.dmcdn.net/static/video/913/040/44040319:jpeg_preview_small.jpg?20120419164908",
|
||||
@"http://static2.dmcdn.net/static/video/090/020/44020090:jpeg_preview_small.jpg?20120418185934",
|
||||
@"http://static2.dmcdn.net/static/video/349/299/43992943:jpeg_preview_small.jpg?20120418112749",
|
||||
@"http://static2.dmcdn.net/static/video/530/189/43981035:jpeg_preview_small.jpg?20120419013834",
|
||||
@"http://static2.dmcdn.net/static/video/763/469/43964367:jpeg_preview_small.jpg?20120425111931",
|
||||
@"http://static2.dmcdn.net/static/video/961/455/43554169:jpeg_preview_small.jpg?20120418110127",
|
||||
@"http://static2.dmcdn.net/static/video/666/889/43988666:jpeg_preview_small.jpg?20120507180735",
|
||||
@"http://static2.dmcdn.net/static/video/160/459/43954061:jpeg_preview_small.jpg?20120501202847",
|
||||
@"http://static2.dmcdn.net/static/video/352/069/43960253:jpeg_preview_small.jpg?20120503175747",
|
||||
@"http://static2.dmcdn.net/static/video/096/502/43205690:jpeg_preview_small.jpg?20120417142655",
|
||||
@"http://static2.dmcdn.net/static/video/257/119/43911752:jpeg_preview_small.jpg?20120416101238",
|
||||
@"http://static2.dmcdn.net/static/video/874/098/43890478:jpeg_preview_small.jpg?20120415193608",
|
||||
@"http://static2.dmcdn.net/static/video/406/148/43841604:jpeg_preview_small.jpg?20120416123145",
|
||||
@"http://static2.dmcdn.net/static/video/463/885/43588364:jpeg_preview_small.jpg?20120409130206",
|
||||
@"http://static2.dmcdn.net/static/video/176/845/38548671:jpeg_preview_small.jpg?20120414200742",
|
||||
@"http://static2.dmcdn.net/static/video/447/848/51848744:jpeg_preview_small.jpg?20121105223446",
|
||||
@"http://static2.dmcdn.net/static/video/337/848/51848733:jpeg_preview_small.jpg?20121105223433",
|
||||
@"http://static2.dmcdn.net/static/video/707/848/51848707:jpeg_preview_small.jpg?20121105223428",
|
||||
@"http://static2.dmcdn.net/static/video/102/848/51848201:jpeg_preview_small.jpg?20121105223411",
|
||||
@"http://static2.dmcdn.net/static/video/817/848/51848718:jpeg_preview_small.jpg?20121105223402",
|
||||
@"http://static2.dmcdn.net/static/video/007/848/51848700:jpeg_preview_small.jpg?20121105223345",
|
||||
@"http://static2.dmcdn.net/static/video/696/848/51848696:jpeg_preview_small.jpg?20121105223355",
|
||||
@"http://static2.dmcdn.net/static/video/296/848/51848692:jpeg_preview_small.jpg?20121105223337",
|
||||
@"http://static2.dmcdn.net/static/video/080/848/51848080:jpeg_preview_small.jpg?20121105223653",
|
||||
@"http://static2.dmcdn.net/static/video/386/848/51848683:jpeg_preview_small.jpg?20121105223343",
|
||||
@"http://static2.dmcdn.net/static/video/876/848/51848678:jpeg_preview_small.jpg?20121105223301",
|
||||
@"http://static2.dmcdn.net/static/video/866/848/51848668:jpeg_preview_small.jpg?20121105223244",
|
||||
@"http://static2.dmcdn.net/static/video/572/548/51845275:jpeg_preview_small.jpg?20121105223229",
|
||||
@"http://static2.dmcdn.net/static/video/972/548/51845279:jpeg_preview_small.jpg?20121105223227",
|
||||
@"http://static2.dmcdn.net/static/video/112/548/51845211:jpeg_preview_small.jpg?20121105223226",
|
||||
@"http://static2.dmcdn.net/static/video/549/448/51844945:jpeg_preview_small.jpg?20121105223223",
|
||||
@"http://static2.dmcdn.net/static/video/166/848/51848661:jpeg_preview_small.jpg?20121105223228",
|
||||
@"http://static2.dmcdn.net/static/video/856/848/51848658:jpeg_preview_small.jpg?20121105223223",
|
||||
@"http://static2.dmcdn.net/static/video/746/848/51848647:jpeg_preview_small.jpg?20121105223204",
|
||||
@"http://static2.dmcdn.net/static/video/446/848/51848644:jpeg_preview_small.jpg?20121105223204",
|
||||
@"http://static2.dmcdn.net/static/video/726/848/51848627:jpeg_preview_small.jpg?20121105223221",
|
||||
@"http://static2.dmcdn.net/static/video/436/848/51848634:jpeg_preview_small.jpg?20121105223445",
|
||||
@"http://static2.dmcdn.net/static/video/836/848/51848638:jpeg_preview_small.jpg?20121105223144",
|
||||
@"http://static2.dmcdn.net/static/video/036/848/51848630:jpeg_preview_small.jpg?20121105223125",
|
||||
@"http://static2.dmcdn.net/static/video/026/848/51848620:jpeg_preview_small.jpg?20121105223102",
|
||||
@"http://static2.dmcdn.net/static/video/895/848/51848598:jpeg_preview_small.jpg?20121105223112",
|
||||
@"http://static2.dmcdn.net/static/video/116/848/51848611:jpeg_preview_small.jpg?20121105223052",
|
||||
@"http://static2.dmcdn.net/static/video/006/848/51848600:jpeg_preview_small.jpg?20121105223043",
|
||||
@"http://static2.dmcdn.net/static/video/432/548/51845234:jpeg_preview_small.jpg?20121105223022",
|
||||
@"http://static2.dmcdn.net/static/video/785/848/51848587:jpeg_preview_small.jpg?20121105223031",
|
||||
@"http://static2.dmcdn.net/static/video/975/848/51848579:jpeg_preview_small.jpg?20121105223012",
|
||||
@"http://static2.dmcdn.net/static/video/965/848/51848569:jpeg_preview_small.jpg?20121105222952",
|
||||
@"http://static2.dmcdn.net/static/video/365/848/51848563:jpeg_preview_small.jpg?20121105222943",
|
||||
@"http://static2.dmcdn.net/static/video/755/848/51848557:jpeg_preview_small.jpg?20121105222943",
|
||||
@"http://static2.dmcdn.net/static/video/722/248/51842227:jpeg_preview_small.jpg?20121105222908",
|
||||
@"http://static2.dmcdn.net/static/video/155/848/51848551:jpeg_preview_small.jpg?20121105222913",
|
||||
@"http://static2.dmcdn.net/static/video/345/848/51848543:jpeg_preview_small.jpg?20121105222907",
|
||||
@"http://static2.dmcdn.net/static/video/535/848/51848535:jpeg_preview_small.jpg?20121105222848",
|
||||
@"http://static2.dmcdn.net/static/video/035/848/51848530:jpeg_preview_small.jpg?20121105222837",
|
||||
@"http://static2.dmcdn.net/static/video/525/848/51848525:jpeg_preview_small.jpg?20121105222826",
|
||||
@"http://static2.dmcdn.net/static/video/233/848/51848332:jpeg_preview_small.jpg?20121105223414",
|
||||
@"http://static2.dmcdn.net/static/video/125/848/51848521:jpeg_preview_small.jpg?20121105222809",
|
||||
@"http://static2.dmcdn.net/static/video/005/848/51848500:jpeg_preview_small.jpg?20121105222802",
|
||||
@"http://static2.dmcdn.net/static/video/015/848/51848510:jpeg_preview_small.jpg?20121105222755",
|
||||
@"http://static2.dmcdn.net/static/video/121/548/51845121:jpeg_preview_small.jpg?20121105222850",
|
||||
@"http://static2.dmcdn.net/static/video/205/848/51848502:jpeg_preview_small.jpg?20121105222737",
|
||||
@"http://static2.dmcdn.net/static/video/697/448/51844796:jpeg_preview_small.jpg?20121105222818",
|
||||
@"http://static2.dmcdn.net/static/video/494/848/51848494:jpeg_preview_small.jpg?20121105222724",
|
||||
@"http://static2.dmcdn.net/static/video/806/448/51844608:jpeg_preview_small.jpg?20121105222811",
|
||||
@"http://static2.dmcdn.net/static/video/729/348/51843927:jpeg_preview_small.jpg?20121105222805",
|
||||
@"http://static2.dmcdn.net/static/video/865/148/51841568:jpeg_preview_small.jpg?20121105222803",
|
||||
@"http://static2.dmcdn.net/static/video/481/548/51845184:jpeg_preview_small.jpg?20121105222700",
|
||||
@"http://static2.dmcdn.net/static/video/190/548/51845091:jpeg_preview_small.jpg?20121105222656",
|
||||
@"http://static2.dmcdn.net/static/video/128/448/51844821:jpeg_preview_small.jpg?20121105222656",
|
||||
@"http://static2.dmcdn.net/static/video/784/848/51848487:jpeg_preview_small.jpg?20121105222704",
|
||||
@"http://static2.dmcdn.net/static/video/182/448/51844281:jpeg_preview_small.jpg?20121105222652",
|
||||
@"http://static2.dmcdn.net/static/video/801/848/51848108:jpeg_preview_small.jpg?20121105222907",
|
||||
@"http://static2.dmcdn.net/static/video/974/848/51848479:jpeg_preview_small.jpg?20121105222657",
|
||||
@"http://static2.dmcdn.net/static/video/274/848/51848472:jpeg_preview_small.jpg?20121105222644",
|
||||
@"http://static2.dmcdn.net/static/video/954/848/51848459:jpeg_preview_small.jpg?20121105222637",
|
||||
@"http://static2.dmcdn.net/static/video/554/848/51848455:jpeg_preview_small.jpg?20121105222615",
|
||||
@"http://static2.dmcdn.net/static/video/944/848/51848449:jpeg_preview_small.jpg?20121105222558",
|
||||
@"http://static2.dmcdn.net/static/video/144/848/51848441:jpeg_preview_small.jpg?20121105222556",
|
||||
@"http://static2.dmcdn.net/static/video/134/848/51848431:jpeg_preview_small.jpg?20121105222539",
|
||||
@"http://static2.dmcdn.net/static/video/624/848/51848426:jpeg_preview_small.jpg?20121105222523",
|
||||
@"http://static2.dmcdn.net/static/video/281/448/51844182:jpeg_preview_small.jpg?20121105222502",
|
||||
@"http://static2.dmcdn.net/static/video/414/848/51848414:jpeg_preview_small.jpg?20121105222516",
|
||||
@"http://static2.dmcdn.net/static/video/171/848/51848171:jpeg_preview_small.jpg?20121105223449",
|
||||
@"http://static2.dmcdn.net/static/video/904/848/51848409:jpeg_preview_small.jpg?20121105222514",
|
||||
@"http://static2.dmcdn.net/static/video/004/848/51848400:jpeg_preview_small.jpg?20121105222443",
|
||||
@"http://static2.dmcdn.net/static/video/693/848/51848396:jpeg_preview_small.jpg?20121105222439",
|
||||
@"http://static2.dmcdn.net/static/video/401/848/51848104:jpeg_preview_small.jpg?20121105222832",
|
||||
@"http://static2.dmcdn.net/static/video/957/648/51846759:jpeg_preview_small.jpg?20121105223109",
|
||||
@"http://static2.dmcdn.net/static/video/603/848/51848306:jpeg_preview_small.jpg?20121105222324",
|
||||
@"http://static2.dmcdn.net/static/video/990/848/51848099:jpeg_preview_small.jpg?20121105222807",
|
||||
@"http://static2.dmcdn.net/static/video/929/448/51844929:jpeg_preview_small.jpg?20121105222216",
|
||||
@"http://static2.dmcdn.net/static/video/320/548/51845023:jpeg_preview_small.jpg?20121105222214",
|
||||
@"http://static2.dmcdn.net/static/video/387/448/51844783:jpeg_preview_small.jpg?20121105222212",
|
||||
@"http://static2.dmcdn.net/static/video/833/248/51842338:jpeg_preview_small.jpg?20121105222209",
|
||||
@"http://static2.dmcdn.net/static/video/993/348/51843399:jpeg_preview_small.jpg?20121105222012",
|
||||
@"http://static2.dmcdn.net/static/video/660/848/51848066:jpeg_preview_small.jpg?20121105222754",
|
||||
@"http://static2.dmcdn.net/static/video/471/848/51848174:jpeg_preview_small.jpg?20121105223419",
|
||||
@"http://static2.dmcdn.net/static/video/255/748/51847552:jpeg_preview_small.jpg?20121105222420",
|
||||
@"http://static2.dmcdn.net/static/video/257/448/51844752:jpeg_preview_small.jpg?20121105221728",
|
||||
@"http://static2.dmcdn.net/static/video/090/848/51848090:jpeg_preview_small.jpg?20121105223020",
|
||||
@"http://static2.dmcdn.net/static/video/807/448/51844708:jpeg_preview_small.jpg?20121105221654",
|
||||
@"http://static2.dmcdn.net/static/video/196/448/51844691:jpeg_preview_small.jpg?20121105222110",
|
||||
@"http://static2.dmcdn.net/static/video/406/448/51844604:jpeg_preview_small.jpg?20121105221647",
|
||||
@"http://static2.dmcdn.net/static/video/865/348/51843568:jpeg_preview_small.jpg?20121105221644",
|
||||
@"http://static2.dmcdn.net/static/video/932/448/51844239:jpeg_preview_small.jpg?20121105221309",
|
||||
@"http://static2.dmcdn.net/static/video/967/438/51834769:jpeg_preview_small.jpg?20121105221020",
|
||||
@"http://static2.dmcdn.net/static/video/362/348/51843263:jpeg_preview_small.jpg?20121105220855",
|
||||
@"http://static2.dmcdn.net/static/video/777/448/51844777:jpeg_preview_small.jpg?20121105220715",
|
||||
@"http://static2.dmcdn.net/static/video/567/348/51843765:jpeg_preview_small.jpg?20121105220708",
|
||||
@"http://static2.dmcdn.net/static/video/905/248/51842509:jpeg_preview_small.jpg?20121105220640",
|
||||
@"http://static2.dmcdn.net/static/video/857/748/51847758:jpeg_preview_small.jpg?20121105221003",
|
||||
@"http://static2.dmcdn.net/static/video/578/348/51843875:jpeg_preview_small.jpg?20121105220350",
|
||||
@"http://static2.dmcdn.net/static/video/214/448/51844412:jpeg_preview_small.jpg?20121105220415",
|
||||
@"http://static2.dmcdn.net/static/video/264/748/51847462:jpeg_preview_small.jpg?20121105220635",
|
||||
@"http://static2.dmcdn.net/static/video/817/748/51847718:jpeg_preview_small.jpg?20121105220233",
|
||||
@"http://static2.dmcdn.net/static/video/784/848/51848487:jpeg_preview_small.jpg?20121105222704",
|
||||
@"http://static2.dmcdn.net/static/video/182/448/51844281:jpeg_preview_small.jpg?20121105222652",
|
||||
@"http://static2.dmcdn.net/static/video/801/848/51848108:jpeg_preview_small.jpg?20121105222907",
|
||||
@"http://static2.dmcdn.net/static/video/974/848/51848479:jpeg_preview_small.jpg?20121105222657",
|
||||
@"http://static2.dmcdn.net/static/video/274/848/51848472:jpeg_preview_small.jpg?20121105222644",
|
||||
@"http://static2.dmcdn.net/static/video/954/848/51848459:jpeg_preview_small.jpg?20121105222637",
|
||||
@"http://static2.dmcdn.net/static/video/554/848/51848455:jpeg_preview_small.jpg?20121105222615",
|
||||
@"http://static2.dmcdn.net/static/video/944/848/51848449:jpeg_preview_small.jpg?20121105222558",
|
||||
@"http://static2.dmcdn.net/static/video/144/848/51848441:jpeg_preview_small.jpg?20121105222556",
|
||||
@"http://static2.dmcdn.net/static/video/134/848/51848431:jpeg_preview_small.jpg?20121105222539",
|
||||
@"http://static2.dmcdn.net/static/video/624/848/51848426:jpeg_preview_small.jpg?20121105222523",
|
||||
@"http://static2.dmcdn.net/static/video/281/448/51844182:jpeg_preview_small.jpg?20121105222502",
|
||||
@"http://static2.dmcdn.net/static/video/414/848/51848414:jpeg_preview_small.jpg?20121105222516",
|
||||
@"http://static2.dmcdn.net/static/video/171/848/51848171:jpeg_preview_small.jpg?20121105223449",
|
||||
@"http://static2.dmcdn.net/static/video/904/848/51848409:jpeg_preview_small.jpg?20121105222514",
|
||||
@"http://static2.dmcdn.net/static/video/004/848/51848400:jpeg_preview_small.jpg?20121105222443",
|
||||
@"http://static2.dmcdn.net/static/video/693/848/51848396:jpeg_preview_small.jpg?20121105222439",
|
||||
@"http://static2.dmcdn.net/static/video/401/848/51848104:jpeg_preview_small.jpg?20121105222832",
|
||||
@"http://static2.dmcdn.net/static/video/957/648/51846759:jpeg_preview_small.jpg?20121105223109",
|
||||
@"http://static2.dmcdn.net/static/video/603/848/51848306:jpeg_preview_small.jpg?20121105222324",
|
||||
@"http://static2.dmcdn.net/static/video/990/848/51848099:jpeg_preview_small.jpg?20121105222807",
|
||||
@"http://static2.dmcdn.net/static/video/929/448/51844929:jpeg_preview_small.jpg?20121105222216",
|
||||
@"http://static2.dmcdn.net/static/video/320/548/51845023:jpeg_preview_small.jpg?20121105222214",
|
||||
@"http://static2.dmcdn.net/static/video/387/448/51844783:jpeg_preview_small.jpg?20121105222212",
|
||||
@"http://static2.dmcdn.net/static/video/833/248/51842338:jpeg_preview_small.jpg?20121105222209",
|
||||
@"http://static2.dmcdn.net/static/video/993/348/51843399:jpeg_preview_small.jpg?20121105222012",
|
||||
@"http://static2.dmcdn.net/static/video/660/848/51848066:jpeg_preview_small.jpg?20121105222754",
|
||||
@"http://static2.dmcdn.net/static/video/471/848/51848174:jpeg_preview_small.jpg?20121105223419",
|
||||
@"http://static2.dmcdn.net/static/video/255/748/51847552:jpeg_preview_small.jpg?20121105222420",
|
||||
@"http://static2.dmcdn.net/static/video/257/448/51844752:jpeg_preview_small.jpg?20121105221728",
|
||||
@"http://static2.dmcdn.net/static/video/090/848/51848090:jpeg_preview_small.jpg?20121105224514",
|
||||
@"http://static2.dmcdn.net/static/video/807/448/51844708:jpeg_preview_small.jpg?20121105221654",
|
||||
@"http://static2.dmcdn.net/static/video/196/448/51844691:jpeg_preview_small.jpg?20121105222110",
|
||||
@"http://static2.dmcdn.net/static/video/406/448/51844604:jpeg_preview_small.jpg?20121105221647",
|
||||
@"http://static2.dmcdn.net/static/video/865/348/51843568:jpeg_preview_small.jpg?20121105221644",
|
||||
@"http://static2.dmcdn.net/static/video/932/448/51844239:jpeg_preview_small.jpg?20121105221309",
|
||||
@"http://static2.dmcdn.net/static/video/967/438/51834769:jpeg_preview_small.jpg?20121105221020",
|
||||
@"http://static2.dmcdn.net/static/video/362/348/51843263:jpeg_preview_small.jpg?20121105220855",
|
||||
@"http://static2.dmcdn.net/static/video/777/448/51844777:jpeg_preview_small.jpg?20121105220715",
|
||||
@"http://static2.dmcdn.net/static/video/567/348/51843765:jpeg_preview_small.jpg?20121105220708",
|
||||
@"http://static2.dmcdn.net/static/video/905/248/51842509:jpeg_preview_small.jpg?20121105220640",
|
||||
@"http://static2.dmcdn.net/static/video/857/748/51847758:jpeg_preview_small.jpg?20121105221003",
|
||||
@"http://static2.dmcdn.net/static/video/578/348/51843875:jpeg_preview_small.jpg?20121105220350",
|
||||
@"http://static2.dmcdn.net/static/video/214/448/51844412:jpeg_preview_small.jpg?20121105220415",
|
||||
@"http://static2.dmcdn.net/static/video/264/748/51847462:jpeg_preview_small.jpg?20121105220635",
|
||||
@"http://static2.dmcdn.net/static/video/817/748/51847718:jpeg_preview_small.jpg?20121105220233",
|
||||
@"http://static2.dmcdn.net/static/video/807/748/51847708:jpeg_preview_small.jpg?20121105220241",
|
||||
@"http://static2.dmcdn.net/static/video/199/838/51838991:jpeg_preview_small.jpg?20121105220605",
|
||||
@"http://static2.dmcdn.net/static/video/776/748/51847677:jpeg_preview_small.jpg?20121105220150",
|
||||
@"http://static2.dmcdn.net/static/video/986/748/51847689:jpeg_preview_small.jpg?20121105224514",
|
||||
@"http://static2.dmcdn.net/static/video/915/748/51847519:jpeg_preview_small.jpg?20121105222216",
|
||||
@"http://static2.dmcdn.net/static/video/983/448/51844389:jpeg_preview_small.jpg?20121105220116",
|
||||
@"http://static2.dmcdn.net/static/video/751/348/51843157:jpeg_preview_small.jpg?20121105220104",
|
||||
@"http://static2.dmcdn.net/static/video/192/538/51835291:jpeg_preview_small.jpg?20121105220103",
|
||||
@"http://static2.dmcdn.net/static/video/596/448/51844695:jpeg_preview_small.jpg?20121105220033",
|
||||
@"http://static2.dmcdn.net/static/video/750/648/51846057:jpeg_preview_small.jpg?20121105221259",
|
||||
@"http://static2.dmcdn.net/static/video/441/148/51841144:jpeg_preview_small.jpg?20121105215911",
|
||||
@"http://static2.dmcdn.net/static/video/860/448/51844068:jpeg_preview_small.jpg?20121105215905",
|
||||
@"http://static2.dmcdn.net/static/video/995/748/51847599:jpeg_preview_small.jpg?20121105215939",
|
||||
@"http://static2.dmcdn.net/static/video/774/748/51847477:jpeg_preview_small.jpg?20121105223414",
|
||||
@"http://static2.dmcdn.net/static/video/498/648/51846894:jpeg_preview_small.jpg?20121105221807",
|
||||
@"http://static2.dmcdn.net/static/video/011/748/51847110:jpeg_preview_small.jpg?20121105221118",
|
||||
@"http://static2.dmcdn.net/static/video/794/748/51847497:jpeg_preview_small.jpg?20121105220829",
|
||||
@"http://static2.dmcdn.net/static/video/988/648/51846889:jpeg_preview_small.jpg?20121105222149",
|
||||
@"http://static2.dmcdn.net/static/video/769/548/51845967:jpeg_preview_small.jpg?20121105215601",
|
||||
@"http://static2.dmcdn.net/static/video/225/448/51844522:jpeg_preview_small.jpg?20121105215552",
|
||||
@"http://static2.dmcdn.net/static/video/172/308/51803271:jpeg_preview_small.jpg?20121105215455",
|
||||
@"http://static2.dmcdn.net/static/video/994/748/51847499:jpeg_preview_small.jpg?20121105220343",
|
||||
@"http://static2.dmcdn.net/static/video/852/748/51847258:jpeg_preview_small.jpg?20121105221031",
|
||||
@"http://static2.dmcdn.net/static/video/671/838/51838176:jpeg_preview_small.jpg?20121105215421",
|
||||
@"http://static2.dmcdn.net/static/video/172/448/51844271:jpeg_preview_small.jpg?20121105215420",
|
||||
@"http://static2.dmcdn.net/static/video/735/448/51844537:jpeg_preview_small.jpg?20121105215437",
|
||||
@"http://static2.dmcdn.net/static/video/834/448/51844438:jpeg_preview_small.jpg?20121105215431",
|
||||
@"http://static2.dmcdn.net/static/video/613/448/51844316:jpeg_preview_small.jpg?20121105215431",
|
||||
@"http://static2.dmcdn.net/static/video/581/748/51847185:jpeg_preview_small.jpg?20121105220637",
|
||||
@"http://static2.dmcdn.net/static/video/407/648/51846704:jpeg_preview_small.jpg?20121105220316",
|
||||
@"http://static2.dmcdn.net/static/video/460/448/51844064:jpeg_preview_small.jpg?20121105215245",
|
||||
@"http://static2.dmcdn.net/static/video/298/648/51846892:jpeg_preview_small.jpg?20121105220953",
|
||||
@"http://static2.dmcdn.net/static/video/053/748/51847350:jpeg_preview_small.jpg?20121105221113",
|
||||
@"http://static2.dmcdn.net/static/video/996/448/51844699:jpeg_preview_small.jpg?20121105222807",
|
||||
@"http://static2.dmcdn.net/static/video/451/448/51844154:jpeg_preview_small.jpg?20121105221955",
|
||||
@"http://static2.dmcdn.net/static/video/049/648/51846940:jpeg_preview_small.jpg?20121105215910",
|
||||
@"http://static2.dmcdn.net/static/video/091/748/51847190:jpeg_preview_small.jpg?20121105215617",
|
||||
@"http://static2.dmcdn.net/static/video/573/748/51847375:jpeg_preview_small.jpg?20121105223420",
|
||||
@"http://static2.dmcdn.net/static/video/103/248/51842301:jpeg_preview_small.jpg?20121105215014",
|
||||
@"http://static2.dmcdn.net/static/video/991/548/51845199:jpeg_preview_small.jpg?20121105215407",
|
||||
@"http://static2.dmcdn.net/static/video/872/648/51846278:jpeg_preview_small.jpg?20121105220635",
|
||||
@"http://static2.dmcdn.net/static/video/813/748/51847318:jpeg_preview_small.jpg?20121105214729",
|
||||
@"http://static2.dmcdn.net/static/video/153/448/51844351:jpeg_preview_small.jpg?20121105214622",
|
||||
@"http://static2.dmcdn.net/static/video/328/648/51846823:jpeg_preview_small.jpg?20121105214944",
|
||||
@"http://static2.dmcdn.net/static/video/892/748/51847298:jpeg_preview_small.jpg?20121105224514",
|
||||
@"http://static2.dmcdn.net/static/video/640/048/51840046:jpeg_preview_small.jpg?20121105214430",
|
||||
@"http://static2.dmcdn.net/static/video/153/648/51846351:jpeg_preview_small.jpg?20121105214426",
|
||||
@"http://static2.dmcdn.net/static/video/769/248/51842967:jpeg_preview_small.jpg?20121105214255",
|
||||
@"http://static2.dmcdn.net/static/video/720/448/51844027:jpeg_preview_small.jpg?20121105214248",
|
||||
@"http://static2.dmcdn.net/static/video/895/048/51840598:jpeg_preview_small.jpg?20121105214234",
|
||||
@"http://static2.dmcdn.net/static/video/893/348/51843398:jpeg_preview_small.jpg?20121105214157",
|
||||
@"http://static2.dmcdn.net/static/video/351/748/51847153:jpeg_preview_small.jpg?20121105214106",
|
||||
@"http://static2.dmcdn.net/static/video/364/648/51846463:jpeg_preview_small.jpg?20121105215005",
|
||||
@"http://static2.dmcdn.net/static/video/269/938/51839962:jpeg_preview_small.jpg?20121105214014",
|
||||
nil];
|
||||
|
||||
for (int i=0; i<100; i++) {
|
||||
[_objects addObject:[NSString stringWithFormat:@"https://s3.amazonaws.com/fast-image-cache/demo-images/FICDDemoImage%03d.jpg", i]];
|
||||
}
|
||||
|
||||
}
|
||||
[SDWebImageManager.sharedManager.imageDownloader setValue:@"SDWebImage Demo" forHTTPHeaderField:@"AppName"];
|
||||
SDWebImageManager.sharedManager.imageDownloader.executionOrder = SDWebImageDownloaderLIFOExecutionOrder;
|
||||
|
|
@ -379,6 +85,9 @@
|
|||
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
|
||||
}
|
||||
|
||||
[cell.imageView setShowActivityIndicatorView:YES];
|
||||
[cell.imageView setIndicatorStyle:UIActivityIndicatorViewStyleGray];
|
||||
|
||||
cell.textLabel.text = [NSString stringWithFormat:@"Image #%ld", (long)indexPath.row];
|
||||
cell.imageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[cell.imageView sd_setImageWithURL:[NSURL URLWithString:[_objects objectAtIndex:indexPath.row]]
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.dailymotion.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
|
|
@ -24,6 +24,11 @@
|
|||
<string>1.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
|
|
|
|||
2
LICENSE
2
LICENSE
|
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2009 Olivier Poitrey <rs@dailymotion.com>
|
||||
Copyright (c) 2016 Olivier Poitrey rs@dailymotion.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
|||
129
README.md
129
README.md
|
|
@ -6,12 +6,13 @@ Web Image
|
|||
[](https://www.apache.org/licenses/LICENSE-2.0.html)
|
||||
[](https://www.versioneye.com/objective-c/sdwebimage/3.3)
|
||||
[](https://www.versioneye.com/objective-c/sdwebimage/references)
|
||||
[](https://github.com/rs/SDWebImage)
|
||||
|
||||
This library provides a category for UIImageView with support for remote images coming from the web.
|
||||
|
||||
It provides:
|
||||
|
||||
- An UIImageView category adding web image and cache management to the Cocoa Touch framework
|
||||
- An `UIImageView` category adding web image and cache management to the Cocoa Touch framework
|
||||
- An asynchronous image downloader
|
||||
- An asynchronous memory + disk image caching with automatic cache expiration handling
|
||||
- Animated GIF support
|
||||
|
|
@ -24,12 +25,12 @@ It provides:
|
|||
- Use GCD and ARC
|
||||
- Arm64 support
|
||||
|
||||
NOTE: The version 3.0 of SDWebImage isn't fully backward compatible with 2.0 and requires iOS 5.1.1
|
||||
minimum deployement version. If you need iOS < 5.0 support, please use the last [2.0 version](https://github.com/rs/SDWebImage/tree/2.0-compat).
|
||||
NOTE: Version 3.8 of SDWebImage requires iOS 7 or later (because of NSURLSession).
|
||||
Versions 3.7 to 3.0 requires iOS 5.1.1. If you need iOS < 5.0 support, please use the last [2.0 version](https://github.com/rs/SDWebImage/tree/2.0-compat).
|
||||
|
||||
[How is SDWebImage better than X?](https://github.com/rs/SDWebImage/wiki/How-is-SDWebImage-better-than-X%3F)
|
||||
|
||||
Who Use It
|
||||
Who Uses It
|
||||
----------
|
||||
|
||||
Find out [who uses SDWebImage](https://github.com/rs/SDWebImage/wiki/Who-Uses-SDWebImage) and add your app to the list.
|
||||
|
|
@ -50,14 +51,11 @@ handled for you, from async downloads to caching management.
|
|||
|
||||
...
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
static NSString *MyIdentifier = @"MyIdentifier";
|
||||
|
||||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
|
||||
|
||||
if (cell == nil)
|
||||
{
|
||||
if (cell == nil) {
|
||||
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
|
||||
reuseIdentifier:MyIdentifier] autorelease];
|
||||
}
|
||||
|
|
@ -73,14 +71,16 @@ handled for you, from async downloads to caching management.
|
|||
|
||||
### Using blocks
|
||||
|
||||
With blocks, you can be notified about the image download progress and whenever the image retrival
|
||||
With blocks, you can be notified about the image download progress and whenever the image retrieval
|
||||
has completed with success or not:
|
||||
|
||||
```objective-c
|
||||
// Here we use the new provided sd_setImageWithURL: method to load the web image
|
||||
[cell.imageView sd_setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]
|
||||
placeholderImage:[UIImage imageNamed:@"placeholder.png"]
|
||||
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {... completion code here ...}];
|
||||
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
|
||||
... completion code here ...
|
||||
}];
|
||||
```
|
||||
|
||||
Note: neither your success nor failure block will be call if your image request is canceled before completion.
|
||||
|
|
@ -96,17 +96,15 @@ Here is a simple example of how to use SDWebImageManager:
|
|||
```objective-c
|
||||
SDWebImageManager *manager = [SDWebImageManager sharedManager];
|
||||
[manager downloadImageWithURL:imageURL
|
||||
options:0
|
||||
progress:^(NSInteger receivedSize, NSInteger expectedSize)
|
||||
{
|
||||
// progression tracking code
|
||||
}
|
||||
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL)
|
||||
{
|
||||
if (image) {
|
||||
// do something with image
|
||||
}
|
||||
}];
|
||||
options:0
|
||||
progress:^(NSInteger receivedSize, NSInteger expectedSize) {
|
||||
// progression tracking code
|
||||
}
|
||||
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
|
||||
if (image) {
|
||||
// do something with image
|
||||
}
|
||||
}];
|
||||
```
|
||||
|
||||
### Using Asynchronous Image Downloader Independently
|
||||
|
|
@ -114,24 +112,22 @@ SDWebImageManager *manager = [SDWebImageManager sharedManager];
|
|||
It's also possible to use the async image downloader independently:
|
||||
|
||||
```objective-c
|
||||
[SDWebImageDownloader.sharedDownloader downloadImageWithURL:imageURL
|
||||
options:0
|
||||
progress:^(NSInteger receivedSize, NSInteger expectedSize)
|
||||
{
|
||||
// progression tracking code
|
||||
}
|
||||
completed:^(UIImage *image, NSData *data, NSError *error, BOOL finished)
|
||||
{
|
||||
if (image && finished)
|
||||
{
|
||||
// do something with image
|
||||
}
|
||||
}];
|
||||
SDWebImageDownloader *downloader = [SDWebImageDownloader sharedDownloader];
|
||||
[downloader downloadImageWithURL:imageURL
|
||||
options:0
|
||||
progress:^(NSInteger receivedSize, NSInteger expectedSize) {
|
||||
// progression tracking code
|
||||
}
|
||||
completed:^(UIImage *image, NSData *data, NSError *error, BOOL finished) {
|
||||
if (image && finished) {
|
||||
// do something with image
|
||||
}
|
||||
}];
|
||||
```
|
||||
|
||||
### Using Asynchronous Image Caching Independently
|
||||
|
||||
It is also possible to use the aync based image cache store independently. SDImageCache
|
||||
It is also possible to use the async based image cache store independently. SDImageCache
|
||||
maintains a memory cache and an optional disk cache. Disk cache write operations are performed
|
||||
asynchronous so it doesn't add unnecessary latency to the UI.
|
||||
|
||||
|
|
@ -145,8 +141,7 @@ the image.
|
|||
|
||||
```objective-c
|
||||
SDImageCache *imageCache = [[SDImageCache alloc] initWithNamespace:@"myNamespace"];
|
||||
[imageCache queryDiskCacheForKey:myCacheKey done:^(UIImage *image)
|
||||
{
|
||||
[imageCache queryDiskCacheForKey:myCacheKey done:^(UIImage *image) {
|
||||
// image is not nil if image was found
|
||||
}];
|
||||
```
|
||||
|
|
@ -174,8 +169,7 @@ The following example sets a filter in the application delegate that will remove
|
|||
the URL before to use it as a cache key:
|
||||
|
||||
```objective-c
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||
{
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
SDWebImageManager.sharedManager.cacheKeyFilter = ^(NSURL *url) {
|
||||
url = [[NSURL alloc] initWithScheme:url.scheme host:url.host path:url.path];
|
||||
return [url absoluteString];
|
||||
|
|
@ -219,7 +213,7 @@ Installation
|
|||
------------
|
||||
|
||||
There are three ways to use SDWebImage in your project:
|
||||
- using Cocoapods
|
||||
- using CocoaPods
|
||||
- copying all the files into your project
|
||||
- importing the project as a static library
|
||||
|
||||
|
|
@ -229,8 +223,53 @@ There are three ways to use SDWebImage in your project:
|
|||
|
||||
#### Podfile
|
||||
```
|
||||
platform :ios, '6.1'
|
||||
pod 'SDWebImage', '~>3.6'
|
||||
platform :ios, '7.0'
|
||||
pod 'SDWebImage', '~>3.8'
|
||||
```
|
||||
|
||||
If you are using Swift, be sure to add `use_frameworks!` and set your target to iOS 8+:
|
||||
```
|
||||
platform :ios, '8.0'
|
||||
use_frameworks!
|
||||
```
|
||||
|
||||
#### Subspecs
|
||||
|
||||
There are 3 subspecs available now: `Core`, `MapKit` and `WebP` (this means you can install only some of the SDWebImage modules. By default, you get just `Core`, so if you need `WebP`, you need to specify it).
|
||||
|
||||
Podfile example:
|
||||
```
|
||||
pod 'SDWebImage/WebP'
|
||||
```
|
||||
|
||||
### Installation with Carthage (iOS 8+)
|
||||
|
||||
[Carthage](https://github.com/Carthage/Carthage) is a lightweight dependency manager for Swift and Objective-C. It leverages CocoaTouch modules and is less invasive than CocoaPods.
|
||||
|
||||
To install with carthage, follow the instruction on [Carthage](https://github.com/Carthage/Carthage)
|
||||
|
||||
#### Cartfile
|
||||
```
|
||||
github "rs/SDWebImage"
|
||||
```
|
||||
|
||||
#### Usage
|
||||
Swift
|
||||
|
||||
If you installed using CocoaPods:
|
||||
```
|
||||
import SDWebImage
|
||||
```
|
||||
|
||||
If you installed manually:
|
||||
```
|
||||
import WebImage
|
||||
```
|
||||
|
||||
Objective-C
|
||||
|
||||
```
|
||||
@import WebImage;
|
||||
```
|
||||
|
||||
### Installation by cloning the repository
|
||||
|
|
@ -267,6 +306,10 @@ If you're using Cocoa Pods and have any frameworks that extend optional librarie
|
|||
```
|
||||
-force_load $(TARGET_BUILD_DIR)/libPods.a
|
||||
```
|
||||
and this:
|
||||
```
|
||||
$(inherited)
|
||||
```
|
||||
|
||||
### Import headers in your source files
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'SDWebImage'
|
||||
s.version = '3.7.2'
|
||||
s.platform = :ios, '5.0'
|
||||
s.version = '3.8.1'
|
||||
s.ios.deployment_target = '7.0'
|
||||
s.tvos.deployment_target = '9.0'
|
||||
s.license = 'MIT'
|
||||
s.summary = 'Asynchronous image downloader with cache support with an UIImageView category.'
|
||||
s.homepage = 'https://github.com/rs/SDWebImage'
|
||||
|
|
@ -24,9 +25,11 @@ Pod::Spec.new do |s|
|
|||
s.subspec 'Core' do |core|
|
||||
core.source_files = 'SDWebImage/{NS,SD,UI}*.{h,m}'
|
||||
core.exclude_files = 'SDWebImage/UIImage+WebP.{h,m}'
|
||||
core.tvos.exclude_files = 'SDWebImage/MKAnnotationView+WebCache.*'
|
||||
end
|
||||
|
||||
s.subspec 'MapKit' do |mk|
|
||||
mk.ios.deployment_target = '7.0'
|
||||
mk.source_files = 'SDWebImage/MKAnnotationView+WebCache.*'
|
||||
mk.framework = 'MapKit'
|
||||
mk.dependency 'SDWebImage/Core'
|
||||
|
|
@ -34,7 +37,10 @@ Pod::Spec.new do |s|
|
|||
|
||||
s.subspec 'WebP' do |webp|
|
||||
webp.source_files = 'SDWebImage/UIImage+WebP.{h,m}'
|
||||
webp.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) SD_WEBP=1' }
|
||||
webp.xcconfig = {
|
||||
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) SD_WEBP=1',
|
||||
'USER_HEADER_SEARCH_PATHS' => '$(inherited) $(SRCROOT)/libwebp/src'
|
||||
}
|
||||
webp.dependency 'SDWebImage/Core'
|
||||
webp.dependency 'libwebp'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -22,6 +22,72 @@
|
|||
/* End PBXAggregateTarget section */
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
00733A541BC4880000A5A117 /* SDWebImageCompat.m in Sources */ = {isa = PBXBuildFile; fileRef = 5340674F167780C40042B59E /* SDWebImageCompat.m */; };
|
||||
00733A551BC4880000A5A117 /* SDWebImageDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 53922D8C148C56230056699D /* SDWebImageDownloader.m */; };
|
||||
00733A561BC4880000A5A117 /* SDWebImageDownloaderOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 530E49E416460AE2002868E7 /* SDWebImageDownloaderOperation.m */; };
|
||||
00733A571BC4880000A5A117 /* SDImageCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 53922D86148C56230056699D /* SDImageCache.m */; };
|
||||
00733A581BC4880000A5A117 /* SDWebImageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 53922D8F148C56230056699D /* SDWebImageManager.m */; };
|
||||
00733A591BC4880000A5A117 /* SDWebImageDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 53922D8A148C56230056699D /* SDWebImageDecoder.m */; };
|
||||
00733A5A1BC4880000A5A117 /* SDWebImagePrefetcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 53922D92148C56230056699D /* SDWebImagePrefetcher.m */; };
|
||||
00733A5B1BC4880000A5A117 /* NSData+ImageContentType.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D5B9141188EE8DD006D06BD /* NSData+ImageContentType.m */; };
|
||||
00733A5C1BC4880000A5A117 /* UIButton+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 53922D94148C56230056699D /* UIButton+WebCache.m */; };
|
||||
00733A5D1BC4880000A5A117 /* UIImage+GIF.m in Sources */ = {isa = PBXBuildFile; fileRef = A18A6CC6172DC28500419892 /* UIImage+GIF.m */; };
|
||||
00733A5E1BC4880000A5A117 /* UIImage+MultiFormat.m in Sources */ = {isa = PBXBuildFile; fileRef = 53EDFB8917623F7C00698166 /* UIImage+MultiFormat.m */; };
|
||||
00733A5F1BC4880000A5A117 /* UIImage+WebP.m in Sources */ = {isa = PBXBuildFile; fileRef = 53EDFB921762547C00698166 /* UIImage+WebP.m */; };
|
||||
00733A601BC4880000A5A117 /* UIImageView+HighlightedWebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = ABBE71A618C43B4D00B75E91 /* UIImageView+HighlightedWebCache.m */; };
|
||||
00733A611BC4880000A5A117 /* UIImageView+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 53922D96148C56230056699D /* UIImageView+WebCache.m */; };
|
||||
00733A621BC4880000A5A117 /* UIView+WebCacheOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = AB615302192DA24600A2D8E9 /* UIView+WebCacheOperation.m */; };
|
||||
00733A631BC4880E00A5A117 /* SDWebImageCompat.h in Headers */ = {isa = PBXBuildFile; fileRef = 53922D88148C56230056699D /* SDWebImageCompat.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
00733A641BC4880E00A5A117 /* SDWebImageOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 530E49E71646388E002868E7 /* SDWebImageOperation.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
00733A651BC4880E00A5A117 /* SDWebImageDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 53922D8B148C56230056699D /* SDWebImageDownloader.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
00733A661BC4880E00A5A117 /* SDWebImageDownloaderOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 530E49E316460AE2002868E7 /* SDWebImageDownloaderOperation.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
00733A671BC4880E00A5A117 /* SDImageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 53922D85148C56230056699D /* SDImageCache.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
00733A681BC4880E00A5A117 /* SDWebImageManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 53922D8E148C56230056699D /* SDWebImageManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
00733A691BC4880E00A5A117 /* SDWebImageDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 53922D89148C56230056699D /* SDWebImageDecoder.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
00733A6A1BC4880E00A5A117 /* SDWebImagePrefetcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 53922D91148C56230056699D /* SDWebImagePrefetcher.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
00733A6B1BC4880E00A5A117 /* NSData+ImageContentType.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D5B9140188EE8DD006D06BD /* NSData+ImageContentType.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
00733A6C1BC4880E00A5A117 /* UIButton+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 53922D93148C56230056699D /* UIButton+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
00733A6D1BC4880E00A5A117 /* UIImage+GIF.h in Headers */ = {isa = PBXBuildFile; fileRef = A18A6CC5172DC28500419892 /* UIImage+GIF.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
00733A6E1BC4880E00A5A117 /* UIImage+MultiFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = 53EDFB8817623F7C00698166 /* UIImage+MultiFormat.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
00733A6F1BC4880E00A5A117 /* UIImage+WebP.h in Headers */ = {isa = PBXBuildFile; fileRef = 53EDFB911762547C00698166 /* UIImage+WebP.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
00733A701BC4880E00A5A117 /* UIImageView+HighlightedWebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = ABBE71A518C43B4D00B75E91 /* UIImageView+HighlightedWebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
00733A711BC4880E00A5A117 /* UIImageView+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 53922D95148C56230056699D /* UIImageView+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
00733A721BC4880E00A5A117 /* UIView+WebCacheOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = AB615301192DA24600A2D8E9 /* UIView+WebCacheOperation.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
00733A731BC4880E00A5A117 /* WebImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A2CAE031AB4BB5400B6BC39 /* WebImage.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4A2CAE041AB4BB5400B6BC39 /* WebImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A2CAE031AB4BB5400B6BC39 /* WebImage.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4A2CAE181AB4BB6400B6BC39 /* SDWebImageCompat.h in Headers */ = {isa = PBXBuildFile; fileRef = 53922D88148C56230056699D /* SDWebImageCompat.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4A2CAE191AB4BB6400B6BC39 /* SDWebImageCompat.m in Sources */ = {isa = PBXBuildFile; fileRef = 5340674F167780C40042B59E /* SDWebImageCompat.m */; };
|
||||
4A2CAE1A1AB4BB6400B6BC39 /* SDWebImageOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 530E49E71646388E002868E7 /* SDWebImageOperation.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4A2CAE1B1AB4BB6800B6BC39 /* SDWebImageDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 53922D8B148C56230056699D /* SDWebImageDownloader.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4A2CAE1C1AB4BB6800B6BC39 /* SDWebImageDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 53922D8C148C56230056699D /* SDWebImageDownloader.m */; };
|
||||
4A2CAE1D1AB4BB6800B6BC39 /* SDWebImageDownloaderOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 530E49E316460AE2002868E7 /* SDWebImageDownloaderOperation.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4A2CAE1E1AB4BB6800B6BC39 /* SDWebImageDownloaderOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 530E49E416460AE2002868E7 /* SDWebImageDownloaderOperation.m */; };
|
||||
4A2CAE1F1AB4BB6C00B6BC39 /* SDImageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 53922D85148C56230056699D /* SDImageCache.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4A2CAE201AB4BB6C00B6BC39 /* SDImageCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 53922D86148C56230056699D /* SDImageCache.m */; };
|
||||
4A2CAE211AB4BB7000B6BC39 /* SDWebImageManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 53922D8E148C56230056699D /* SDWebImageManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4A2CAE221AB4BB7000B6BC39 /* SDWebImageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 53922D8F148C56230056699D /* SDWebImageManager.m */; };
|
||||
4A2CAE231AB4BB7000B6BC39 /* SDWebImageDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 53922D89148C56230056699D /* SDWebImageDecoder.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4A2CAE241AB4BB7000B6BC39 /* SDWebImageDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 53922D8A148C56230056699D /* SDWebImageDecoder.m */; };
|
||||
4A2CAE251AB4BB7000B6BC39 /* SDWebImagePrefetcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 53922D91148C56230056699D /* SDWebImagePrefetcher.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4A2CAE261AB4BB7000B6BC39 /* SDWebImagePrefetcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 53922D92148C56230056699D /* SDWebImagePrefetcher.m */; };
|
||||
4A2CAE271AB4BB7500B6BC39 /* MKAnnotationView+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 535699B415113E7300A4C397 /* MKAnnotationView+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4A2CAE281AB4BB7500B6BC39 /* MKAnnotationView+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 535699B515113E7300A4C397 /* MKAnnotationView+WebCache.m */; };
|
||||
4A2CAE291AB4BB7500B6BC39 /* NSData+ImageContentType.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D5B9140188EE8DD006D06BD /* NSData+ImageContentType.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4A2CAE2A1AB4BB7500B6BC39 /* NSData+ImageContentType.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D5B9141188EE8DD006D06BD /* NSData+ImageContentType.m */; };
|
||||
4A2CAE2B1AB4BB7500B6BC39 /* UIButton+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 53922D93148C56230056699D /* UIButton+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4A2CAE2C1AB4BB7500B6BC39 /* UIButton+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 53922D94148C56230056699D /* UIButton+WebCache.m */; };
|
||||
4A2CAE2D1AB4BB7500B6BC39 /* UIImage+GIF.h in Headers */ = {isa = PBXBuildFile; fileRef = A18A6CC5172DC28500419892 /* UIImage+GIF.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4A2CAE2E1AB4BB7500B6BC39 /* UIImage+GIF.m in Sources */ = {isa = PBXBuildFile; fileRef = A18A6CC6172DC28500419892 /* UIImage+GIF.m */; };
|
||||
4A2CAE2F1AB4BB7500B6BC39 /* UIImage+MultiFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = 53EDFB8817623F7C00698166 /* UIImage+MultiFormat.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4A2CAE301AB4BB7500B6BC39 /* UIImage+MultiFormat.m in Sources */ = {isa = PBXBuildFile; fileRef = 53EDFB8917623F7C00698166 /* UIImage+MultiFormat.m */; };
|
||||
4A2CAE311AB4BB7500B6BC39 /* UIImage+WebP.h in Headers */ = {isa = PBXBuildFile; fileRef = 53EDFB911762547C00698166 /* UIImage+WebP.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4A2CAE321AB4BB7500B6BC39 /* UIImage+WebP.m in Sources */ = {isa = PBXBuildFile; fileRef = 53EDFB921762547C00698166 /* UIImage+WebP.m */; };
|
||||
4A2CAE331AB4BB7500B6BC39 /* UIImageView+HighlightedWebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = ABBE71A518C43B4D00B75E91 /* UIImageView+HighlightedWebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4A2CAE341AB4BB7500B6BC39 /* UIImageView+HighlightedWebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = ABBE71A618C43B4D00B75E91 /* UIImageView+HighlightedWebCache.m */; };
|
||||
4A2CAE351AB4BB7500B6BC39 /* UIImageView+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 53922D95148C56230056699D /* UIImageView+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4A2CAE361AB4BB7500B6BC39 /* UIImageView+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 53922D96148C56230056699D /* UIImageView+WebCache.m */; };
|
||||
4A2CAE371AB4BB7500B6BC39 /* UIView+WebCacheOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = AB615301192DA24600A2D8E9 /* UIView+WebCacheOperation.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4A2CAE381AB4BB7500B6BC39 /* UIView+WebCacheOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = AB615302192DA24600A2D8E9 /* UIView+WebCacheOperation.m */; };
|
||||
530E49E816464C25002868E7 /* SDWebImageOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 530E49E71646388E002868E7 /* SDWebImageOperation.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
530E49E916464C26002868E7 /* SDWebImageOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 530E49E71646388E002868E7 /* SDWebImageOperation.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
530E49EA16464C7C002868E7 /* SDWebImageDownloaderOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 530E49E316460AE2002868E7 /* SDWebImageDownloaderOperation.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
|
|
@ -213,6 +279,10 @@
|
|||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
00733A4C1BC487C000A5A117 /* WebImage.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WebImage.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
4A2CADFF1AB4BB5300B6BC39 /* WebImage.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WebImage.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
4A2CAE021AB4BB5400B6BC39 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
4A2CAE031AB4BB5400B6BC39 /* WebImage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebImage.h; sourceTree = "<group>"; };
|
||||
530E49E316460AE2002868E7 /* SDWebImageDownloaderOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDWebImageDownloaderOperation.h; sourceTree = "<group>"; };
|
||||
530E49E416460AE2002868E7 /* SDWebImageDownloaderOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDWebImageDownloaderOperation.m; sourceTree = "<group>"; };
|
||||
530E49E71646388E002868E7 /* SDWebImageOperation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDWebImageOperation.h; sourceTree = "<group>"; };
|
||||
|
|
@ -331,6 +401,20 @@
|
|||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
00733A481BC487C000A5A117 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
4A2CADFB1AB4BB5300B6BC39 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
531041CC157EAFA400BBABC3 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
|
|
@ -364,10 +448,28 @@
|
|||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
4A2CAE001AB4BB5300B6BC39 /* WebImage */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4A2CAE031AB4BB5400B6BC39 /* WebImage.h */,
|
||||
4A2CAE011AB4BB5400B6BC39 /* Supporting Files */,
|
||||
);
|
||||
path = WebImage;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4A2CAE011AB4BB5400B6BC39 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4A2CAE021AB4BB5400B6BC39 /* Info.plist */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
53922D64148C55810056699D = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
53922D74148C55820056699D /* SDWebImage */,
|
||||
4A2CAE001AB4BB5300B6BC39 /* WebImage */,
|
||||
53922D71148C55820056699D /* Frameworks */,
|
||||
53922D70148C55820056699D /* Products */,
|
||||
);
|
||||
|
|
@ -380,6 +482,8 @@
|
|||
53761325155AD0D5005750A4 /* libSDWebImage.a */,
|
||||
531041E0157EAFA400BBABC3 /* libSDWebImage+MKAnnotation.a */,
|
||||
537D95C117ECC1FE0097C263 /* libSDWebImage+WebP.a */,
|
||||
4A2CADFF1AB4BB5300B6BC39 /* WebImage.framework */,
|
||||
00733A4C1BC487C000A5A117 /* WebImage.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -594,6 +698,55 @@
|
|||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
00733A491BC487C000A5A117 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
00733A6F1BC4880E00A5A117 /* UIImage+WebP.h in Headers */,
|
||||
00733A681BC4880E00A5A117 /* SDWebImageManager.h in Headers */,
|
||||
00733A6C1BC4880E00A5A117 /* UIButton+WebCache.h in Headers */,
|
||||
00733A731BC4880E00A5A117 /* WebImage.h in Headers */,
|
||||
00733A701BC4880E00A5A117 /* UIImageView+HighlightedWebCache.h in Headers */,
|
||||
00733A671BC4880E00A5A117 /* SDImageCache.h in Headers */,
|
||||
00733A711BC4880E00A5A117 /* UIImageView+WebCache.h in Headers */,
|
||||
00733A631BC4880E00A5A117 /* SDWebImageCompat.h in Headers */,
|
||||
00733A661BC4880E00A5A117 /* SDWebImageDownloaderOperation.h in Headers */,
|
||||
00733A721BC4880E00A5A117 /* UIView+WebCacheOperation.h in Headers */,
|
||||
00733A6B1BC4880E00A5A117 /* NSData+ImageContentType.h in Headers */,
|
||||
00733A6A1BC4880E00A5A117 /* SDWebImagePrefetcher.h in Headers */,
|
||||
00733A641BC4880E00A5A117 /* SDWebImageOperation.h in Headers */,
|
||||
00733A6E1BC4880E00A5A117 /* UIImage+MultiFormat.h in Headers */,
|
||||
00733A6D1BC4880E00A5A117 /* UIImage+GIF.h in Headers */,
|
||||
00733A651BC4880E00A5A117 /* SDWebImageDownloader.h in Headers */,
|
||||
00733A691BC4880E00A5A117 /* SDWebImageDecoder.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
4A2CADFC1AB4BB5300B6BC39 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
4A2CAE041AB4BB5400B6BC39 /* WebImage.h in Headers */,
|
||||
4A2CAE211AB4BB7000B6BC39 /* SDWebImageManager.h in Headers */,
|
||||
4A2CAE1F1AB4BB6C00B6BC39 /* SDImageCache.h in Headers */,
|
||||
4A2CAE351AB4BB7500B6BC39 /* UIImageView+WebCache.h in Headers */,
|
||||
4A2CAE181AB4BB6400B6BC39 /* SDWebImageCompat.h in Headers */,
|
||||
4A2CAE331AB4BB7500B6BC39 /* UIImageView+HighlightedWebCache.h in Headers */,
|
||||
4A2CAE1D1AB4BB6800B6BC39 /* SDWebImageDownloaderOperation.h in Headers */,
|
||||
4A2CAE2B1AB4BB7500B6BC39 /* UIButton+WebCache.h in Headers */,
|
||||
4A2CAE251AB4BB7000B6BC39 /* SDWebImagePrefetcher.h in Headers */,
|
||||
4A2CAE371AB4BB7500B6BC39 /* UIView+WebCacheOperation.h in Headers */,
|
||||
4A2CAE2F1AB4BB7500B6BC39 /* UIImage+MultiFormat.h in Headers */,
|
||||
4A2CAE1A1AB4BB6400B6BC39 /* SDWebImageOperation.h in Headers */,
|
||||
4A2CAE1B1AB4BB6800B6BC39 /* SDWebImageDownloader.h in Headers */,
|
||||
4A2CAE271AB4BB7500B6BC39 /* MKAnnotationView+WebCache.h in Headers */,
|
||||
4A2CAE231AB4BB7000B6BC39 /* SDWebImageDecoder.h in Headers */,
|
||||
4A2CAE311AB4BB7500B6BC39 /* UIImage+WebP.h in Headers */,
|
||||
4A2CAE2D1AB4BB7500B6BC39 /* UIImage+GIF.h in Headers */,
|
||||
4A2CAE291AB4BB7500B6BC39 /* NSData+ImageContentType.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
531041D0157EAFA400BBABC3 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
|
|
@ -697,6 +850,42 @@
|
|||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
00733A4B1BC487C000A5A117 /* WebImage tvOS */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 00733A531BC487C100A5A117 /* Build configuration list for PBXNativeTarget "WebImage tvOS" */;
|
||||
buildPhases = (
|
||||
00733A471BC487C000A5A117 /* Sources */,
|
||||
00733A481BC487C000A5A117 /* Frameworks */,
|
||||
00733A491BC487C000A5A117 /* Headers */,
|
||||
00733A4A1BC487C000A5A117 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "WebImage tvOS";
|
||||
productName = "WebImage tvOS";
|
||||
productReference = 00733A4C1BC487C000A5A117 /* WebImage.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
4A2CADFE1AB4BB5300B6BC39 /* WebImage */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 4A2CAE121AB4BB5400B6BC39 /* Build configuration list for PBXNativeTarget "WebImage" */;
|
||||
buildPhases = (
|
||||
4A2CADFA1AB4BB5300B6BC39 /* Sources */,
|
||||
4A2CADFB1AB4BB5300B6BC39 /* Frameworks */,
|
||||
4A2CADFC1AB4BB5300B6BC39 /* Headers */,
|
||||
4A2CADFD1AB4BB5300B6BC39 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = WebImage;
|
||||
productName = WebImage;
|
||||
productReference = 4A2CADFF1AB4BB5300B6BC39 /* WebImage.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
531041C2157EAFA400BBABC3 /* SDWebImage+MKAnnotation */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 531041DD157EAFA400BBABC3 /* Build configuration list for PBXNativeTarget "SDWebImage+MKAnnotation" */;
|
||||
|
|
@ -756,8 +945,16 @@
|
|||
53922D66148C55810056699D /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0510;
|
||||
LastUpgradeCheck = 0710;
|
||||
ORGANIZATIONNAME = Dailymotion;
|
||||
TargetAttributes = {
|
||||
00733A4B1BC487C000A5A117 = {
|
||||
CreatedOnToolsVersion = 7.1;
|
||||
};
|
||||
4A2CADFE1AB4BB5300B6BC39 = {
|
||||
CreatedOnToolsVersion = 6.3;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 53922D69148C55810056699D /* Build configuration list for PBXProject "SDWebImage" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
|
|
@ -775,10 +972,29 @@
|
|||
537D957317ECC1FE0097C263 /* SDWebImage+WebP */,
|
||||
531041C2157EAFA400BBABC3 /* SDWebImage+MKAnnotation */,
|
||||
539F912B16316D2D00160719 /* SDWebImageFramework */,
|
||||
4A2CADFE1AB4BB5300B6BC39 /* WebImage */,
|
||||
00733A4B1BC487C000A5A117 /* WebImage tvOS */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
00733A4A1BC487C000A5A117 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
4A2CADFD1AB4BB5300B6BC39 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
537D95BD17ECC1FE0097C263 /* Prepare Framework */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
|
|
@ -825,6 +1041,51 @@
|
|||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
00733A471BC487C000A5A117 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
00733A561BC4880000A5A117 /* SDWebImageDownloaderOperation.m in Sources */,
|
||||
00733A5A1BC4880000A5A117 /* SDWebImagePrefetcher.m in Sources */,
|
||||
00733A5B1BC4880000A5A117 /* NSData+ImageContentType.m in Sources */,
|
||||
00733A551BC4880000A5A117 /* SDWebImageDownloader.m in Sources */,
|
||||
00733A611BC4880000A5A117 /* UIImageView+WebCache.m in Sources */,
|
||||
00733A581BC4880000A5A117 /* SDWebImageManager.m in Sources */,
|
||||
00733A541BC4880000A5A117 /* SDWebImageCompat.m in Sources */,
|
||||
00733A621BC4880000A5A117 /* UIView+WebCacheOperation.m in Sources */,
|
||||
00733A591BC4880000A5A117 /* SDWebImageDecoder.m in Sources */,
|
||||
00733A5F1BC4880000A5A117 /* UIImage+WebP.m in Sources */,
|
||||
00733A5C1BC4880000A5A117 /* UIButton+WebCache.m in Sources */,
|
||||
00733A5D1BC4880000A5A117 /* UIImage+GIF.m in Sources */,
|
||||
00733A571BC4880000A5A117 /* SDImageCache.m in Sources */,
|
||||
00733A5E1BC4880000A5A117 /* UIImage+MultiFormat.m in Sources */,
|
||||
00733A601BC4880000A5A117 /* UIImageView+HighlightedWebCache.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
4A2CADFA1AB4BB5300B6BC39 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
4A2CAE2E1AB4BB7500B6BC39 /* UIImage+GIF.m in Sources */,
|
||||
4A2CAE321AB4BB7500B6BC39 /* UIImage+WebP.m in Sources */,
|
||||
4A2CAE361AB4BB7500B6BC39 /* UIImageView+WebCache.m in Sources */,
|
||||
4A2CAE1E1AB4BB6800B6BC39 /* SDWebImageDownloaderOperation.m in Sources */,
|
||||
4A2CAE281AB4BB7500B6BC39 /* MKAnnotationView+WebCache.m in Sources */,
|
||||
4A2CAE261AB4BB7000B6BC39 /* SDWebImagePrefetcher.m in Sources */,
|
||||
4A2CAE301AB4BB7500B6BC39 /* UIImage+MultiFormat.m in Sources */,
|
||||
4A2CAE1C1AB4BB6800B6BC39 /* SDWebImageDownloader.m in Sources */,
|
||||
4A2CAE2A1AB4BB7500B6BC39 /* NSData+ImageContentType.m in Sources */,
|
||||
4A2CAE221AB4BB7000B6BC39 /* SDWebImageManager.m in Sources */,
|
||||
4A2CAE191AB4BB6400B6BC39 /* SDWebImageCompat.m in Sources */,
|
||||
4A2CAE2C1AB4BB7500B6BC39 /* UIButton+WebCache.m in Sources */,
|
||||
4A2CAE381AB4BB7500B6BC39 /* UIView+WebCacheOperation.m in Sources */,
|
||||
4A2CAE241AB4BB7000B6BC39 /* SDWebImageDecoder.m in Sources */,
|
||||
4A2CAE341AB4BB7500B6BC39 /* UIImageView+HighlightedWebCache.m in Sources */,
|
||||
4A2CAE201AB4BB6C00B6BC39 /* SDImageCache.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
531041C3157EAFA400BBABC3 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
|
|
@ -947,6 +1208,192 @@
|
|||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
00733A511BC487C100A5A117 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
INFOPLIST_FILE = WebImage/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.dailymotion.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = WebImage;
|
||||
PUBLIC_HEADERS_FOLDER_PATH = WebImage.framework/Headers;
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
TARGETED_DEVICE_FAMILY = 3;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
00733A521BC487C100A5A117 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
INFOPLIST_FILE = WebImage/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.dailymotion.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = WebImage;
|
||||
PUBLIC_HEADERS_FOLDER_PATH = WebImage.framework/Headers;
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
TARGETED_DEVICE_FAMILY = 3;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
4A2CAE131AB4BB5400B6BC39 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
INFOPLIST_FILE = WebImage/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.dailymotion.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PUBLIC_HEADERS_FOLDER_PATH = WebImage.framework/Headers;
|
||||
SKIP_INSTALL = YES;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
4A2CAE141AB4BB5400B6BC39 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
INFOPLIST_FILE = WebImage/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.dailymotion.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PUBLIC_HEADERS_FOLDER_PATH = WebImage.framework/Headers;
|
||||
SKIP_INSTALL = YES;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
531041DE157EAFA400BBABC3 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
|
|
@ -962,7 +1409,6 @@
|
|||
GCC_PREFIX_HEADER = "";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
|
||||
INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
ONLY_ACTIVE_ARCH = NO;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "SDWebImage+MKAnnotation";
|
||||
|
|
@ -986,7 +1432,6 @@
|
|||
GCC_PREFIX_HEADER = "";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
|
||||
INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "SDWebImage+MKAnnotation";
|
||||
SKIP_INSTALL = YES;
|
||||
|
|
@ -997,6 +1442,7 @@
|
|||
53761323155AD0D5005750A4 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
APPLICATION_EXTENSION_API_ONLY = NO;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEAD_CODE_STRIPPING = NO;
|
||||
|
|
@ -1009,7 +1455,6 @@
|
|||
GCC_PREFIX_HEADER = "";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
|
||||
INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = SDWebImage;
|
||||
SKIP_INSTALL = YES;
|
||||
|
|
@ -1020,6 +1465,7 @@
|
|||
53761324155AD0D5005750A4 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
APPLICATION_EXTENSION_API_ONLY = NO;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEAD_CODE_STRIPPING = NO;
|
||||
|
|
@ -1032,7 +1478,6 @@
|
|||
GCC_PREFIX_HEADER = "";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "";
|
||||
INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = SDWebImage;
|
||||
SKIP_INSTALL = YES;
|
||||
|
|
@ -1059,7 +1504,6 @@
|
|||
"$(inherited)",
|
||||
);
|
||||
INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "SDWebImage+WebP";
|
||||
SKIP_INSTALL = YES;
|
||||
|
|
@ -1082,7 +1526,6 @@
|
|||
GCC_PREFIX_HEADER = "";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "SD_WEBP=1";
|
||||
INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "SDWebImage+WebP";
|
||||
SKIP_INSTALL = YES;
|
||||
|
|
@ -1095,6 +1538,7 @@
|
|||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
|
|
@ -1117,7 +1561,7 @@
|
|||
GCC_WARN_UNUSED_PARAMETER = NO;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = Vendors/libwebp/src;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PUBLIC_HEADERS_FOLDER_PATH = include/SDWebImage;
|
||||
RUN_CLANG_STATIC_ANALYZER = YES;
|
||||
|
|
@ -1146,7 +1590,7 @@
|
|||
GCC_WARN_UNUSED_PARAMETER = NO;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = Vendors/libwebp/src;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
PUBLIC_HEADERS_FOLDER_PATH = include/SDWebImage;
|
||||
RUN_CLANG_STATIC_ANALYZER = YES;
|
||||
SDKROOT = iphoneos;
|
||||
|
|
@ -1157,7 +1601,6 @@
|
|||
539F912D16316D2D00160719 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
|
|
@ -1165,7 +1608,6 @@
|
|||
539F912E16316D2D00160719 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
|
|
@ -1173,6 +1615,24 @@
|
|||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
00733A531BC487C100A5A117 /* Build configuration list for PBXNativeTarget "WebImage tvOS" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
00733A511BC487C100A5A117 /* Debug */,
|
||||
00733A521BC487C100A5A117 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
4A2CAE121AB4BB5400B6BC39 /* Build configuration list for PBXNativeTarget "WebImage" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
4A2CAE131AB4BB5400B6BC39 /* Debug */,
|
||||
4A2CAE141AB4BB5400B6BC39 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
531041DD157EAFA400BBABC3 /* Build configuration list for PBXNativeTarget "SDWebImage+MKAnnotation" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
|
|
|
|||
|
|
@ -0,0 +1,80 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0710"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "00733A4B1BC487C000A5A117"
|
||||
BuildableName = "WebImage.framework"
|
||||
BlueprintName = "WebImage tvOS"
|
||||
ReferencedContainer = "container:SDWebImage.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "00733A4B1BC487C000A5A117"
|
||||
BuildableName = "WebImage.framework"
|
||||
BlueprintName = "WebImage tvOS"
|
||||
ReferencedContainer = "container:SDWebImage.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "00733A4B1BC487C000A5A117"
|
||||
BuildableName = "WebImage.framework"
|
||||
BlueprintName = "WebImage tvOS"
|
||||
ReferencedContainer = "container:SDWebImage.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0710"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "4A2CADFE1AB4BB5300B6BC39"
|
||||
BuildableName = "WebImage.framework"
|
||||
BlueprintName = "WebImage"
|
||||
ReferencedContainer = "container:SDWebImage.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "4A2CADFE1AB4BB5300B6BC39"
|
||||
BuildableName = "WebImage.framework"
|
||||
BlueprintName = "WebImage"
|
||||
ReferencedContainer = "container:SDWebImage.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "4A2CADFE1AB4BB5300B6BC39"
|
||||
BuildableName = "WebImage.framework"
|
||||
BlueprintName = "WebImage"
|
||||
ReferencedContainer = "container:SDWebImage.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
|
|
@ -7,6 +7,18 @@
|
|||
<FileRef
|
||||
location = "group:Tests/SDWebImage Tests.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:LICENSE">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:README.md">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:SDWebImage.podspec">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:CHANGELOG.md">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Tests/Pods/Pods.xcodeproj">
|
||||
</FileRef>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0510"
|
||||
LastUpgradeVersion = "0710"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
@ -23,10 +23,10 @@
|
|||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
|
|
@ -38,17 +38,21 @@
|
|||
ReferencedContainer = "container:Examples/SDWebImage Demo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable>
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "53761294155AB74D005750A4"
|
||||
|
|
@ -61,12 +65,13 @@
|
|||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable>
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "53761294155AB74D005750A4"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0510"
|
||||
LastUpgradeVersion = "0710"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
@ -23,21 +23,24 @@
|
|||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
|
|
@ -52,10 +55,10 @@
|
|||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0510"
|
||||
LastUpgradeVersion = "0710"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
@ -23,21 +23,24 @@
|
|||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
|
|
@ -52,10 +55,10 @@
|
|||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0510"
|
||||
LastUpgradeVersion = "0710"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
@ -23,21 +23,24 @@
|
|||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
|
|
@ -52,10 +55,10 @@
|
|||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0510"
|
||||
LastUpgradeVersion = "0710"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
@ -23,21 +23,24 @@
|
|||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
|
|
@ -52,10 +55,10 @@
|
|||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0610"
|
||||
LastUpgradeVersion = "0710"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
@ -23,10 +23,10 @@
|
|||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
|
|
@ -48,15 +48,18 @@
|
|||
ReferencedContainer = "container:Tests/SDWebImage Tests.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
|
|
@ -71,10 +74,10 @@
|
|||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
|
|
|
|||
|
|
@ -0,0 +1,80 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0710"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "4A2CADFE1AB4BB5300B6BC39"
|
||||
BuildableName = "WebImage.framework"
|
||||
BlueprintName = "WebImage"
|
||||
ReferencedContainer = "container:SDWebImage.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "4A2CADFE1AB4BB5300B6BC39"
|
||||
BuildableName = "WebImage.framework"
|
||||
BlueprintName = "WebImage"
|
||||
ReferencedContainer = "container:SDWebImage.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "4A2CADFE1AB4BB5300B6BC39"
|
||||
BuildableName = "WebImage.framework"
|
||||
BlueprintName = "WebImage"
|
||||
ReferencedContainer = "container:SDWebImage.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
|
|
@ -63,7 +63,7 @@
|
|||
* @param completedBlock A block called when operation has been completed. This block has no return value
|
||||
* and takes the requested UIImage as first parameter. In case of error the image parameter
|
||||
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
|
||||
* indicating if the image was retrived from the local cache or from the network.
|
||||
* indicating if the image was retrieved from the local cache or from the network.
|
||||
* The fourth parameter is the original image url.
|
||||
*/
|
||||
- (void)sd_setImageWithURL:(NSURL *)url completed:(SDWebImageCompletionBlock)completedBlock;
|
||||
|
|
@ -78,7 +78,7 @@
|
|||
* @param completedBlock A block called when operation has been completed. This block has no return value
|
||||
* and takes the requested UIImage as first parameter. In case of error the image parameter
|
||||
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
|
||||
* indicating if the image was retrived from the local cache or from the network.
|
||||
* indicating if the image was retrieved from the local cache or from the network.
|
||||
* The fourth parameter is the original image url.
|
||||
*/
|
||||
- (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletionBlock)completedBlock;
|
||||
|
|
@ -94,7 +94,7 @@
|
|||
* @param completedBlock A block called when operation has been completed. This block has no return value
|
||||
* and takes the requested UIImage as first parameter. In case of error the image parameter
|
||||
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
|
||||
* indicating if the image was retrived from the local cache or from the network.
|
||||
* indicating if the image was retrieved from the local cache or from the network.
|
||||
* The fourth parameter is the original image url.
|
||||
*/
|
||||
- (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletionBlock)completedBlock;
|
||||
|
|
|
|||
|
|
@ -45,14 +45,23 @@ static char imageURLKey;
|
|||
self.image = placeholder;
|
||||
|
||||
if (url) {
|
||||
__weak MKAnnotationView *wself = self;
|
||||
__weak __typeof(self)wself = self;
|
||||
id <SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadImageWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
|
||||
if (!wself) return;
|
||||
dispatch_main_sync_safe(^{
|
||||
__strong MKAnnotationView *sself = wself;
|
||||
if (!sself) return;
|
||||
if (image) {
|
||||
sself.image = image;
|
||||
if (image && (options & SDWebImageAvoidAutoSetImage) && completedBlock) {
|
||||
completedBlock(image, error, cacheType, url);
|
||||
return;
|
||||
} else if (image) {
|
||||
wself.image = image;
|
||||
[wself setNeedsLayout];
|
||||
} else {
|
||||
if ((options & SDWebImageDelayPlaceholder)) {
|
||||
wself.image = placeholder;
|
||||
[wself setNeedsLayout];
|
||||
}
|
||||
}
|
||||
if (completedBlock && finished) {
|
||||
completedBlock(image, error, cacheType, url);
|
||||
|
|
@ -62,7 +71,7 @@ static char imageURLKey;
|
|||
[self sd_setImageLoadOperation:operation forKey:@"MKAnnotationViewImage"];
|
||||
} else {
|
||||
dispatch_main_async_safe(^{
|
||||
NSError *error = [NSError errorWithDomain:@"SDWebImageErrorDomain" code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}];
|
||||
NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}];
|
||||
if (completedBlock) {
|
||||
completedBlock(nil, error, SDImageCacheTypeNone, url);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,16 +37,31 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot
|
|||
@interface SDImageCache : NSObject
|
||||
|
||||
/**
|
||||
* Decompressing images that are downloaded and cached can improve peformance but can consume lot of memory.
|
||||
* Decompressing images that are downloaded and cached can improve performance but can consume lot of memory.
|
||||
* Defaults to YES. Set this to NO if you are experiencing a crash due to excessive memory consumption.
|
||||
*/
|
||||
@property (assign, nonatomic) BOOL shouldDecompressImages;
|
||||
|
||||
/**
|
||||
* disable iCloud backup [defaults to YES]
|
||||
*/
|
||||
@property (assign, nonatomic) BOOL shouldDisableiCloud;
|
||||
|
||||
/**
|
||||
* use memory cache [defaults to YES]
|
||||
*/
|
||||
@property (assign, nonatomic) BOOL shouldCacheImagesInMemory;
|
||||
|
||||
/**
|
||||
* The maximum "total cost" of the in-memory image cache. The cost function is the number of pixels held in memory.
|
||||
*/
|
||||
@property (assign, nonatomic) NSUInteger maxMemoryCost;
|
||||
|
||||
/**
|
||||
* The maximum number of objects the cache should hold.
|
||||
*/
|
||||
@property (assign, nonatomic) NSUInteger maxMemoryCountLimit;
|
||||
|
||||
/**
|
||||
* The maximum length of time to keep an image in the cache, in seconds
|
||||
*/
|
||||
|
|
@ -71,6 +86,16 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot
|
|||
*/
|
||||
- (id)initWithNamespace:(NSString *)ns;
|
||||
|
||||
/**
|
||||
* Init a new cache store with a specific namespace and directory
|
||||
*
|
||||
* @param ns The namespace to use for this cache store
|
||||
* @param directory Directory to cache disk images in
|
||||
*/
|
||||
- (id)initWithNamespace:(NSString *)ns diskCacheDirectory:(NSString *)directory;
|
||||
|
||||
-(NSString *)makeDiskCachePath:(NSString*)fullNamespace;
|
||||
|
||||
/**
|
||||
* Add a read-only cache path to search for images pre-cached by SDImageCache
|
||||
* Useful if you want to bundle pre-loaded images with your app
|
||||
|
|
@ -109,6 +134,14 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot
|
|||
*/
|
||||
- (void)storeImage:(UIImage *)image recalculateFromImage:(BOOL)recalculate imageData:(NSData *)imageData forKey:(NSString *)key toDisk:(BOOL)toDisk;
|
||||
|
||||
/**
|
||||
* Store image NSData into disk cache at the given key.
|
||||
*
|
||||
* @param imageData The image data to store
|
||||
* @param key The unique image cache key, usually it's image absolute URL
|
||||
*/
|
||||
- (void)storeImageDataToDisk:(NSData *)imageData forKey:(NSString *)key;
|
||||
|
||||
/**
|
||||
* Query the disk cache asynchronously.
|
||||
*
|
||||
|
|
@ -131,7 +164,7 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot
|
|||
- (UIImage *)imageFromDiskCacheForKey:(NSString *)key;
|
||||
|
||||
/**
|
||||
* Remove the image from memory and disk cache synchronously
|
||||
* Remove the image from memory and disk cache asynchronously
|
||||
*
|
||||
* @param key The unique image cache key
|
||||
*/
|
||||
|
|
@ -139,7 +172,7 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot
|
|||
|
||||
|
||||
/**
|
||||
* Remove the image from memory and disk cache synchronously
|
||||
* Remove the image from memory and disk cache asynchronously
|
||||
*
|
||||
* @param key The unique image cache key
|
||||
* @param completion An block that should be executed after the image has been removed (optional)
|
||||
|
|
@ -147,7 +180,7 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot
|
|||
- (void)removeImageForKey:(NSString *)key withCompletion:(SDWebImageNoParamsBlock)completion;
|
||||
|
||||
/**
|
||||
* Remove the image from memory and optionally disk cache synchronously
|
||||
* Remove the image from memory and optionally disk cache asynchronously
|
||||
*
|
||||
* @param key The unique image cache key
|
||||
* @param fromDisk Also remove cache entry from disk if YES
|
||||
|
|
@ -155,7 +188,7 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot
|
|||
- (void)removeImageForKey:(NSString *)key fromDisk:(BOOL)fromDisk;
|
||||
|
||||
/**
|
||||
* Remove the image from memory and optionally disk cache synchronously
|
||||
* Remove the image from memory and optionally disk cache asynchronously
|
||||
*
|
||||
* @param key The unique image cache key
|
||||
* @param fromDisk Also remove cache entry from disk if YES
|
||||
|
|
@ -229,7 +262,7 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot
|
|||
* Get the cache path for a certain key (needs the cache path root folder)
|
||||
*
|
||||
* @param key the key (can be obtained from url using cacheKeyForURL)
|
||||
* @param path the cach path root folder
|
||||
* @param path the cache path root folder
|
||||
*
|
||||
* @return the cache path
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -11,6 +11,29 @@
|
|||
#import "UIImage+MultiFormat.h"
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
|
||||
// See https://github.com/rs/SDWebImage/pull/1141 for discussion
|
||||
@interface AutoPurgeCache : NSCache
|
||||
@end
|
||||
|
||||
@implementation AutoPurgeCache
|
||||
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(removeAllObjects) name:UIApplicationDidReceiveMemoryWarningNotification object:nil];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil];
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
static const NSInteger kDefaultCacheMaxCacheAge = 60 * 60 * 24 * 7; // 1 week
|
||||
// PNG signature bytes and data (below)
|
||||
static unsigned char kPNGSignatureBytes[8] = {0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A};
|
||||
|
|
@ -29,6 +52,10 @@ BOOL ImageDataHasPNGPreffix(NSData *data) {
|
|||
return NO;
|
||||
}
|
||||
|
||||
FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
|
||||
return image.size.height * image.size.width * image.scale * image.scale;
|
||||
}
|
||||
|
||||
@interface SDImageCache ()
|
||||
|
||||
@property (strong, nonatomic) NSCache *memCache;
|
||||
|
|
@ -57,6 +84,11 @@ BOOL ImageDataHasPNGPreffix(NSData *data) {
|
|||
}
|
||||
|
||||
- (id)initWithNamespace:(NSString *)ns {
|
||||
NSString *path = [self makeDiskCachePath:ns];
|
||||
return [self initWithNamespace:ns diskCacheDirectory:path];
|
||||
}
|
||||
|
||||
- (id)initWithNamespace:(NSString *)ns diskCacheDirectory:(NSString *)directory {
|
||||
if ((self = [super init])) {
|
||||
NSString *fullNamespace = [@"com.hackemist.SDWebImageCache." stringByAppendingString:ns];
|
||||
|
||||
|
|
@ -70,21 +102,31 @@ BOOL ImageDataHasPNGPreffix(NSData *data) {
|
|||
_maxCacheAge = kDefaultCacheMaxCacheAge;
|
||||
|
||||
// Init the memory cache
|
||||
_memCache = [[NSCache alloc] init];
|
||||
_memCache = [[AutoPurgeCache alloc] init];
|
||||
_memCache.name = fullNamespace;
|
||||
|
||||
// Init the disk cache
|
||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
|
||||
_diskCachePath = [paths[0] stringByAppendingPathComponent:fullNamespace];
|
||||
if (directory != nil) {
|
||||
_diskCachePath = [directory stringByAppendingPathComponent:fullNamespace];
|
||||
} else {
|
||||
NSString *path = [self makeDiskCachePath:ns];
|
||||
_diskCachePath = path;
|
||||
}
|
||||
|
||||
// Set decompression to YES
|
||||
_shouldDecompressImages = YES;
|
||||
|
||||
// memory cache enabled
|
||||
_shouldCacheImagesInMemory = YES;
|
||||
|
||||
// Disable iCloud
|
||||
_shouldDisableiCloud = YES;
|
||||
|
||||
dispatch_sync(_ioQueue, ^{
|
||||
_fileManager = [NSFileManager new];
|
||||
});
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
#if TARGET_OS_IOS
|
||||
// Subscribe to app events
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(clearMemory)
|
||||
|
|
@ -139,20 +181,30 @@ BOOL ImageDataHasPNGPreffix(NSData *data) {
|
|||
}
|
||||
unsigned char r[CC_MD5_DIGEST_LENGTH];
|
||||
CC_MD5(str, (CC_LONG)strlen(str), r);
|
||||
NSString *filename = [NSString stringWithFormat:@"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
|
||||
r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8], r[9], r[10], r[11], r[12], r[13], r[14], r[15]];
|
||||
NSString *filename = [NSString stringWithFormat:@"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%@",
|
||||
r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8], r[9], r[10],
|
||||
r[11], r[12], r[13], r[14], r[15], [[key pathExtension] isEqualToString:@""] ? @"" : [NSString stringWithFormat:@".%@", [key pathExtension]]];
|
||||
|
||||
return filename;
|
||||
}
|
||||
|
||||
#pragma mark ImageCache
|
||||
|
||||
// Init the disk cache
|
||||
-(NSString *)makeDiskCachePath:(NSString*)fullNamespace{
|
||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
|
||||
return [paths[0] stringByAppendingPathComponent:fullNamespace];
|
||||
}
|
||||
|
||||
- (void)storeImage:(UIImage *)image recalculateFromImage:(BOOL)recalculate imageData:(NSData *)imageData forKey:(NSString *)key toDisk:(BOOL)toDisk {
|
||||
if (!image || !key) {
|
||||
return;
|
||||
}
|
||||
|
||||
[self.memCache setObject:image forKey:key cost:image.size.height * image.size.width * image.scale * image.scale];
|
||||
// if memory cache is enabled
|
||||
if (self.shouldCacheImagesInMemory) {
|
||||
NSUInteger cost = SDCacheCostForImage(image);
|
||||
[self.memCache setObject:image forKey:key cost:cost];
|
||||
}
|
||||
|
||||
if (toDisk) {
|
||||
dispatch_async(self.ioQueue, ^{
|
||||
|
|
@ -165,9 +217,13 @@ BOOL ImageDataHasPNGPreffix(NSData *data) {
|
|||
// The first eight bytes of a PNG file always contain the following (decimal) values:
|
||||
// 137 80 78 71 13 10 26 10
|
||||
|
||||
// We assume the image is PNG, in case the imageData is nil (i.e. if trying to save a UIImage directly),
|
||||
// we will consider it PNG to avoid loosing the transparency
|
||||
BOOL imageIsPng = YES;
|
||||
// If the imageData is nil (i.e. if trying to save a UIImage directly or the image was transformed on download)
|
||||
// and the image has an alpha channel, we will consider it PNG to avoid losing the transparency
|
||||
int alphaInfo = CGImageGetAlphaInfo(image.CGImage);
|
||||
BOOL hasAlpha = !(alphaInfo == kCGImageAlphaNone ||
|
||||
alphaInfo == kCGImageAlphaNoneSkipFirst ||
|
||||
alphaInfo == kCGImageAlphaNoneSkipLast);
|
||||
BOOL imageIsPng = hasAlpha;
|
||||
|
||||
// But if we have an image data, we will look at the preffix
|
||||
if ([imageData length] >= [kPNGSignatureData length]) {
|
||||
|
|
@ -185,13 +241,7 @@ BOOL ImageDataHasPNGPreffix(NSData *data) {
|
|||
#endif
|
||||
}
|
||||
|
||||
if (data) {
|
||||
if (![_fileManager fileExistsAtPath:_diskCachePath]) {
|
||||
[_fileManager createDirectoryAtPath:_diskCachePath withIntermediateDirectories:YES attributes:nil error:NULL];
|
||||
}
|
||||
|
||||
[_fileManager createFileAtPath:[self defaultCachePathForKey:key] contents:data attributes:nil];
|
||||
}
|
||||
[self storeImageDataToDisk:data forKey:key];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -204,12 +254,41 @@ BOOL ImageDataHasPNGPreffix(NSData *data) {
|
|||
[self storeImage:image recalculateFromImage:YES imageData:nil forKey:key toDisk:toDisk];
|
||||
}
|
||||
|
||||
- (void)storeImageDataToDisk:(NSData *)imageData forKey:(NSString *)key {
|
||||
|
||||
if (!imageData) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (![_fileManager fileExistsAtPath:_diskCachePath]) {
|
||||
[_fileManager createDirectoryAtPath:_diskCachePath withIntermediateDirectories:YES attributes:nil error:NULL];
|
||||
}
|
||||
|
||||
// get cache Path for image key
|
||||
NSString *cachePathForKey = [self defaultCachePathForKey:key];
|
||||
// transform to NSUrl
|
||||
NSURL *fileURL = [NSURL fileURLWithPath:cachePathForKey];
|
||||
|
||||
[_fileManager createFileAtPath:cachePathForKey contents:imageData attributes:nil];
|
||||
|
||||
// disable iCloud backup
|
||||
if (self.shouldDisableiCloud) {
|
||||
[fileURL setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)diskImageExistsWithKey:(NSString *)key {
|
||||
BOOL exists = NO;
|
||||
|
||||
// this is an exception to access the filemanager on another queue than ioQueue, but we are using the shared instance
|
||||
// from apple docs on NSFileManager: The methods of the shared NSFileManager object can be called from multiple threads safely.
|
||||
exists = [[NSFileManager defaultManager] fileExistsAtPath:[self defaultCachePathForKey:key]];
|
||||
|
||||
// fallback because of https://github.com/rs/SDWebImage/pull/976 that added the extension to the disk file name
|
||||
// checking the key with and without the extension
|
||||
if (!exists) {
|
||||
exists = [[NSFileManager defaultManager] fileExistsAtPath:[[self defaultCachePathForKey:key] stringByDeletingPathExtension]];
|
||||
}
|
||||
|
||||
return exists;
|
||||
}
|
||||
|
|
@ -217,6 +296,13 @@ BOOL ImageDataHasPNGPreffix(NSData *data) {
|
|||
- (void)diskImageExistsWithKey:(NSString *)key completion:(SDWebImageCheckCacheCompletionBlock)completionBlock {
|
||||
dispatch_async(_ioQueue, ^{
|
||||
BOOL exists = [_fileManager fileExistsAtPath:[self defaultCachePathForKey:key]];
|
||||
|
||||
// fallback because of https://github.com/rs/SDWebImage/pull/976 that added the extension to the disk file name
|
||||
// checking the key with and without the extension
|
||||
if (!exists) {
|
||||
exists = [_fileManager fileExistsAtPath:[[self defaultCachePathForKey:key] stringByDeletingPathExtension]];
|
||||
}
|
||||
|
||||
if (completionBlock) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
completionBlock(exists);
|
||||
|
|
@ -230,6 +316,7 @@ BOOL ImageDataHasPNGPreffix(NSData *data) {
|
|||
}
|
||||
|
||||
- (UIImage *)imageFromDiskCacheForKey:(NSString *)key {
|
||||
|
||||
// First check the in-memory cache...
|
||||
UIImage *image = [self imageFromMemoryCacheForKey:key];
|
||||
if (image) {
|
||||
|
|
@ -238,8 +325,8 @@ BOOL ImageDataHasPNGPreffix(NSData *data) {
|
|||
|
||||
// Second check the disk cache...
|
||||
UIImage *diskImage = [self diskImageForKey:key];
|
||||
if (diskImage) {
|
||||
CGFloat cost = diskImage.size.height * diskImage.size.width * diskImage.scale * diskImage.scale;
|
||||
if (diskImage && self.shouldCacheImagesInMemory) {
|
||||
NSUInteger cost = SDCacheCostForImage(diskImage);
|
||||
[self.memCache setObject:diskImage forKey:key cost:cost];
|
||||
}
|
||||
|
||||
|
|
@ -253,12 +340,27 @@ BOOL ImageDataHasPNGPreffix(NSData *data) {
|
|||
return data;
|
||||
}
|
||||
|
||||
for (NSString *path in self.customPaths) {
|
||||
// fallback because of https://github.com/rs/SDWebImage/pull/976 that added the extension to the disk file name
|
||||
// checking the key with and without the extension
|
||||
data = [NSData dataWithContentsOfFile:[defaultPath stringByDeletingPathExtension]];
|
||||
if (data) {
|
||||
return data;
|
||||
}
|
||||
|
||||
NSArray *customPaths = [self.customPaths copy];
|
||||
for (NSString *path in customPaths) {
|
||||
NSString *filePath = [self cachePathForKey:key inPath:path];
|
||||
NSData *imageData = [NSData dataWithContentsOfFile:filePath];
|
||||
if (imageData) {
|
||||
return imageData;
|
||||
}
|
||||
|
||||
// fallback because of https://github.com/rs/SDWebImage/pull/976 that added the extension to the disk file name
|
||||
// checking the key with and without the extension
|
||||
imageData = [NSData dataWithContentsOfFile:[filePath stringByDeletingPathExtension]];
|
||||
if (imageData) {
|
||||
return imageData;
|
||||
}
|
||||
}
|
||||
|
||||
return nil;
|
||||
|
|
@ -308,8 +410,8 @@ BOOL ImageDataHasPNGPreffix(NSData *data) {
|
|||
|
||||
@autoreleasepool {
|
||||
UIImage *diskImage = [self diskImageForKey:key];
|
||||
if (diskImage) {
|
||||
CGFloat cost = diskImage.size.height * diskImage.size.width * diskImage.scale * diskImage.scale;
|
||||
if (diskImage && self.shouldCacheImagesInMemory) {
|
||||
NSUInteger cost = SDCacheCostForImage(diskImage);
|
||||
[self.memCache setObject:diskImage forKey:key cost:cost];
|
||||
}
|
||||
|
||||
|
|
@ -339,9 +441,11 @@ BOOL ImageDataHasPNGPreffix(NSData *data) {
|
|||
if (key == nil) {
|
||||
return;
|
||||
}
|
||||
|
||||
[self.memCache removeObjectForKey:key];
|
||||
|
||||
|
||||
if (self.shouldCacheImagesInMemory) {
|
||||
[self.memCache removeObjectForKey:key];
|
||||
}
|
||||
|
||||
if (fromDisk) {
|
||||
dispatch_async(self.ioQueue, ^{
|
||||
[_fileManager removeItemAtPath:[self defaultCachePathForKey:key] error:nil];
|
||||
|
|
@ -366,6 +470,14 @@ BOOL ImageDataHasPNGPreffix(NSData *data) {
|
|||
return self.memCache.totalCostLimit;
|
||||
}
|
||||
|
||||
- (NSUInteger)maxMemoryCountLimit {
|
||||
return self.memCache.countLimit;
|
||||
}
|
||||
|
||||
- (void)setMaxMemoryCountLimit:(NSUInteger)maxCountLimit {
|
||||
self.memCache.countLimit = maxCountLimit;
|
||||
}
|
||||
|
||||
- (void)clearMemory {
|
||||
[self.memCache removeAllObjects];
|
||||
}
|
||||
|
|
@ -418,8 +530,8 @@ BOOL ImageDataHasPNGPreffix(NSData *data) {
|
|||
for (NSURL *fileURL in fileEnumerator) {
|
||||
NSDictionary *resourceValues = [fileURL resourceValuesForKeys:resourceKeys error:NULL];
|
||||
|
||||
// Skip directories.
|
||||
if ([resourceValues[NSURLIsDirectoryKey] boolValue]) {
|
||||
// Skip nil or directories.
|
||||
if (!resourceValues || [resourceValues[NSURLIsDirectoryKey] boolValue]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -474,7 +586,11 @@ BOOL ImageDataHasPNGPreffix(NSData *data) {
|
|||
}
|
||||
|
||||
- (void)backgroundCleanDisk {
|
||||
UIApplication *application = [UIApplication sharedApplication];
|
||||
Class UIApplicationClass = NSClassFromString(@"UIApplication");
|
||||
if(!UIApplicationClass || ![UIApplicationClass respondsToSelector:@selector(sharedApplication)]) {
|
||||
return;
|
||||
}
|
||||
UIApplication *application = [UIApplication performSelector:@selector(sharedApplication)];
|
||||
__block UIBackgroundTaskIdentifier bgTask = [application beginBackgroundTaskWithExpirationHandler:^{
|
||||
// Clean up any unfinished task business by marking where you
|
||||
// stopped or ending the task outright.
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@
|
|||
#error SDWebImage does not support Objective-C Garbage Collection
|
||||
#endif
|
||||
|
||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0
|
||||
#error SDWebImage doesn't support Deployement Target version < 5.0
|
||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED != 20000 && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0
|
||||
#error SDWebImage doesn't support Deployment Target version < 5.0
|
||||
#endif
|
||||
|
||||
#if !TARGET_OS_IPHONE
|
||||
|
|
@ -55,6 +55,8 @@ extern UIImage *SDScaledImageForKey(NSString *key, UIImage *image);
|
|||
|
||||
typedef void(^SDWebImageNoParamsBlock)();
|
||||
|
||||
extern NSString *const SDWebImageErrorDomain;
|
||||
|
||||
#define dispatch_main_sync_safe(block)\
|
||||
if ([NSThread isMainThread]) {\
|
||||
block();\
|
||||
|
|
|
|||
|
|
@ -28,13 +28,17 @@ inline UIImage *SDScaledImageForKey(NSString *key, UIImage *image) {
|
|||
}
|
||||
else {
|
||||
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
|
||||
CGFloat scale = 1.0;
|
||||
CGFloat scale = 1;
|
||||
if (key.length >= 8) {
|
||||
// Search @2x. at the end of the string, before a 3 to 4 extension length (only if key len is 8 or more @2x. + 4 len ext)
|
||||
NSRange range = [key rangeOfString:@"@2x." options:0 range:NSMakeRange(key.length - 8, 5)];
|
||||
NSRange range = [key rangeOfString:@"@2x."];
|
||||
if (range.location != NSNotFound) {
|
||||
scale = 2.0;
|
||||
}
|
||||
|
||||
range = [key rangeOfString:@"@3x."];
|
||||
if (range.location != NSNotFound) {
|
||||
scale = 3.0;
|
||||
}
|
||||
}
|
||||
|
||||
UIImage *scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:image.imageOrientation];
|
||||
|
|
@ -43,3 +47,5 @@ inline UIImage *SDScaledImageForKey(NSString *key, UIImage *image) {
|
|||
return image;
|
||||
}
|
||||
}
|
||||
|
||||
NSString *const SDWebImageErrorDomain = @"SDWebImageErrorDomain";
|
||||
|
|
|
|||
|
|
@ -13,60 +13,80 @@
|
|||
@implementation UIImage (ForceDecode)
|
||||
|
||||
+ (UIImage *)decodedImageWithImage:(UIImage *)image {
|
||||
if (image.images) {
|
||||
// Do not decode animated images
|
||||
return image;
|
||||
// while downloading huge amount of images
|
||||
// autorelease the bitmap context
|
||||
// and all vars to help system to free memory
|
||||
// when there are memory warning.
|
||||
// on iOS7, do not forget to call
|
||||
// [[SDImageCache sharedImageCache] clearMemory];
|
||||
|
||||
if (image == nil) { // Prevent "CGBitmapContextCreateImage: invalid context 0x0" error
|
||||
return nil;
|
||||
}
|
||||
|
||||
@autoreleasepool{
|
||||
// do not decode animated images
|
||||
if (image.images != nil) {
|
||||
return image;
|
||||
}
|
||||
|
||||
CGImageRef imageRef = image.CGImage;
|
||||
|
||||
CGImageAlphaInfo alpha = CGImageGetAlphaInfo(imageRef);
|
||||
BOOL anyAlpha = (alpha == kCGImageAlphaFirst ||
|
||||
alpha == kCGImageAlphaLast ||
|
||||
alpha == kCGImageAlphaPremultipliedFirst ||
|
||||
alpha == kCGImageAlphaPremultipliedLast);
|
||||
if (anyAlpha) {
|
||||
return image;
|
||||
}
|
||||
|
||||
// current
|
||||
CGColorSpaceModel imageColorSpaceModel = CGColorSpaceGetModel(CGImageGetColorSpace(imageRef));
|
||||
CGColorSpaceRef colorspaceRef = CGImageGetColorSpace(imageRef);
|
||||
|
||||
BOOL unsupportedColorSpace = (imageColorSpaceModel == kCGColorSpaceModelUnknown ||
|
||||
imageColorSpaceModel == kCGColorSpaceModelMonochrome ||
|
||||
imageColorSpaceModel == kCGColorSpaceModelCMYK ||
|
||||
imageColorSpaceModel == kCGColorSpaceModelIndexed);
|
||||
if (unsupportedColorSpace) {
|
||||
colorspaceRef = CGColorSpaceCreateDeviceRGB();
|
||||
}
|
||||
|
||||
size_t width = CGImageGetWidth(imageRef);
|
||||
size_t height = CGImageGetHeight(imageRef);
|
||||
NSUInteger bytesPerPixel = 4;
|
||||
NSUInteger bytesPerRow = bytesPerPixel * width;
|
||||
NSUInteger bitsPerComponent = 8;
|
||||
|
||||
CGImageRef imageRef = image.CGImage;
|
||||
CGSize imageSize = CGSizeMake(CGImageGetWidth(imageRef), CGImageGetHeight(imageRef));
|
||||
CGRect imageRect = (CGRect){.origin = CGPointZero, .size = imageSize};
|
||||
|
||||
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
|
||||
CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef);
|
||||
|
||||
int infoMask = (bitmapInfo & kCGBitmapAlphaInfoMask);
|
||||
BOOL anyNonAlpha = (infoMask == kCGImageAlphaNone ||
|
||||
infoMask == kCGImageAlphaNoneSkipFirst ||
|
||||
infoMask == kCGImageAlphaNoneSkipLast);
|
||||
|
||||
// CGBitmapContextCreate doesn't support kCGImageAlphaNone with RGB.
|
||||
// https://developer.apple.com/library/mac/#qa/qa1037/_index.html
|
||||
if (infoMask == kCGImageAlphaNone && CGColorSpaceGetNumberOfComponents(colorSpace) > 1) {
|
||||
// Unset the old alpha info.
|
||||
bitmapInfo &= ~kCGBitmapAlphaInfoMask;
|
||||
|
||||
// Set noneSkipFirst.
|
||||
bitmapInfo |= kCGImageAlphaNoneSkipFirst;
|
||||
// kCGImageAlphaNone is not supported in CGBitmapContextCreate.
|
||||
// Since the original image here has no alpha info, use kCGImageAlphaNoneSkipLast
|
||||
// to create bitmap graphics contexts without alpha info.
|
||||
CGContextRef context = CGBitmapContextCreate(NULL,
|
||||
width,
|
||||
height,
|
||||
bitsPerComponent,
|
||||
bytesPerRow,
|
||||
colorspaceRef,
|
||||
kCGBitmapByteOrderDefault|kCGImageAlphaNoneSkipLast);
|
||||
|
||||
// Draw the image into the context and retrieve the new bitmap image without alpha
|
||||
CGContextDrawImage(context, CGRectMake(0, 0, width, height), imageRef);
|
||||
CGImageRef imageRefWithoutAlpha = CGBitmapContextCreateImage(context);
|
||||
UIImage *imageWithoutAlpha = [UIImage imageWithCGImage:imageRefWithoutAlpha
|
||||
scale:image.scale
|
||||
orientation:image.imageOrientation];
|
||||
|
||||
if (unsupportedColorSpace) {
|
||||
CGColorSpaceRelease(colorspaceRef);
|
||||
}
|
||||
|
||||
CGContextRelease(context);
|
||||
CGImageRelease(imageRefWithoutAlpha);
|
||||
|
||||
return imageWithoutAlpha;
|
||||
}
|
||||
// Some PNGs tell us they have alpha but only 3 components. Odd.
|
||||
else if (!anyNonAlpha && CGColorSpaceGetNumberOfComponents(colorSpace) == 3) {
|
||||
// Unset the old alpha info.
|
||||
bitmapInfo &= ~kCGBitmapAlphaInfoMask;
|
||||
bitmapInfo |= kCGImageAlphaPremultipliedFirst;
|
||||
}
|
||||
|
||||
// It calculates the bytes-per-row based on the bitsPerComponent and width arguments.
|
||||
CGContextRef context = CGBitmapContextCreate(NULL,
|
||||
imageSize.width,
|
||||
imageSize.height,
|
||||
CGImageGetBitsPerComponent(imageRef),
|
||||
0,
|
||||
colorSpace,
|
||||
bitmapInfo);
|
||||
CGColorSpaceRelease(colorSpace);
|
||||
|
||||
// If failed, return undecompressed image
|
||||
if (!context) return image;
|
||||
|
||||
CGContextDrawImage(context, imageRect, imageRef);
|
||||
CGImageRef decompressedImageRef = CGBitmapContextCreateImage(context);
|
||||
|
||||
CGContextRelease(context);
|
||||
|
||||
UIImage *decompressedImage = [UIImage imageWithCGImage:decompressedImageRef scale:image.scale orientation:image.imageOrientation];
|
||||
CGImageRelease(decompressedImageRef);
|
||||
return decompressedImage;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ typedef NS_OPTIONS(NSUInteger, SDWebImageDownloaderOptions) {
|
|||
SDWebImageDownloaderProgressiveDownload = 1 << 1,
|
||||
|
||||
/**
|
||||
* By default, request prevent the of NSURLCache. With this flag, NSURLCache
|
||||
* By default, request prevent the use of NSURLCache. With this flag, NSURLCache
|
||||
* is used with default policies.
|
||||
*/
|
||||
SDWebImageDownloaderUseNSURLCache = 1 << 2,
|
||||
|
|
@ -40,7 +40,7 @@ typedef NS_OPTIONS(NSUInteger, SDWebImageDownloaderOptions) {
|
|||
SDWebImageDownloaderHandleCookies = 1 << 5,
|
||||
|
||||
/**
|
||||
* Enable to allow untrusted SSL ceriticates.
|
||||
* Enable to allow untrusted SSL certificates.
|
||||
* Useful for testing purposes. Use with caution in production.
|
||||
*/
|
||||
SDWebImageDownloaderAllowInvalidSSLCertificates = 1 << 6,
|
||||
|
|
@ -78,7 +78,7 @@ typedef NSDictionary *(^SDWebImageDownloaderHeadersFilterBlock)(NSURL *url, NSDi
|
|||
@interface SDWebImageDownloader : NSObject
|
||||
|
||||
/**
|
||||
* Decompressing images that are downloaded and cached can improve peformance but can consume lot of memory.
|
||||
* Decompressing images that are downloaded and cached can improve performance but can consume lot of memory.
|
||||
* Defaults to YES. Set this to NO if you are experiencing a crash due to excessive memory consumption.
|
||||
*/
|
||||
@property (assign, nonatomic) BOOL shouldDecompressImages;
|
||||
|
|
@ -109,6 +109,11 @@ typedef NSDictionary *(^SDWebImageDownloaderHeadersFilterBlock)(NSURL *url, NSDi
|
|||
*/
|
||||
+ (SDWebImageDownloader *)sharedDownloader;
|
||||
|
||||
/**
|
||||
* Set the default URL credential to be set for request operations.
|
||||
*/
|
||||
@property (strong, nonatomic) NSURLCredential *urlCredential;
|
||||
|
||||
/**
|
||||
* Set username
|
||||
*/
|
||||
|
|
@ -183,4 +188,9 @@ typedef NSDictionary *(^SDWebImageDownloaderHeadersFilterBlock)(NSURL *url, NSDi
|
|||
*/
|
||||
- (void)setSuspended:(BOOL)suspended;
|
||||
|
||||
/**
|
||||
* Cancels all download operations in the queue
|
||||
*/
|
||||
- (void)cancelAllDownloads;
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -10,13 +10,10 @@
|
|||
#import "SDWebImageDownloaderOperation.h"
|
||||
#import <ImageIO/ImageIO.h>
|
||||
|
||||
NSString *const SDWebImageDownloadStartNotification = @"SDWebImageDownloadStartNotification";
|
||||
NSString *const SDWebImageDownloadStopNotification = @"SDWebImageDownloadStopNotification";
|
||||
|
||||
static NSString *const kProgressCallbackKey = @"progress";
|
||||
static NSString *const kCompletedCallbackKey = @"completed";
|
||||
|
||||
@interface SDWebImageDownloader ()
|
||||
@interface SDWebImageDownloader () <NSURLSessionTaskDelegate, NSURLSessionDataDelegate>
|
||||
|
||||
@property (strong, nonatomic) NSOperationQueue *downloadQueue;
|
||||
@property (weak, nonatomic) NSOperation *lastAddedOperation;
|
||||
|
|
@ -26,6 +23,9 @@ static NSString *const kCompletedCallbackKey = @"completed";
|
|||
// This queue is used to serialize the handling of the network responses of all the download operation in a single queue
|
||||
@property (SDDispatchQueueSetterSementics, nonatomic) dispatch_queue_t barrierQueue;
|
||||
|
||||
// The session in which data tasks will run
|
||||
@property (strong, nonatomic) NSURLSession *session;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SDWebImageDownloader
|
||||
|
|
@ -70,14 +70,33 @@ static NSString *const kCompletedCallbackKey = @"completed";
|
|||
_downloadQueue = [NSOperationQueue new];
|
||||
_downloadQueue.maxConcurrentOperationCount = 6;
|
||||
_URLCallbacks = [NSMutableDictionary new];
|
||||
_HTTPHeaders = [NSMutableDictionary dictionaryWithObject:@"image/webp,image/*;q=0.8" forKey:@"Accept"];
|
||||
#ifdef SD_WEBP
|
||||
_HTTPHeaders = [@{@"Accept": @"image/webp,image/*;q=0.8"} mutableCopy];
|
||||
#else
|
||||
_HTTPHeaders = [@{@"Accept": @"image/*;q=0.8"} mutableCopy];
|
||||
#endif
|
||||
_barrierQueue = dispatch_queue_create("com.hackemist.SDWebImageDownloaderBarrierQueue", DISPATCH_QUEUE_CONCURRENT);
|
||||
_downloadTimeout = 15.0;
|
||||
|
||||
NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration];
|
||||
sessionConfig.timeoutIntervalForRequest = _downloadTimeout;
|
||||
|
||||
/**
|
||||
* Create the session for this task
|
||||
* We send nil as delegate queue so that the session creates a serial operation queue for performing all delegate
|
||||
* method calls and completion handler calls.
|
||||
*/
|
||||
self.session = [NSURLSession sessionWithConfiguration:sessionConfig
|
||||
delegate:self
|
||||
delegateQueue:nil];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[self.session invalidateAndCancel];
|
||||
self.session = nil;
|
||||
|
||||
[self.downloadQueue cancelAllOperations];
|
||||
SDDispatchQueueRelease(_barrierQueue);
|
||||
}
|
||||
|
|
@ -113,9 +132,9 @@ static NSString *const kCompletedCallbackKey = @"completed";
|
|||
|
||||
- (id <SDWebImageOperation>)downloadImageWithURL:(NSURL *)url options:(SDWebImageDownloaderOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageDownloaderCompletedBlock)completedBlock {
|
||||
__block SDWebImageDownloaderOperation *operation;
|
||||
__weak SDWebImageDownloader *wself = self;
|
||||
__weak __typeof(self)wself = self;
|
||||
|
||||
[self addProgressCallback:progressBlock andCompletedBlock:completedBlock forURL:url createCallback:^{
|
||||
[self addProgressCallback:progressBlock completedBlock:completedBlock forURL:url createCallback:^{
|
||||
NSTimeInterval timeoutInterval = wself.downloadTimeout;
|
||||
if (timeoutInterval == 0.0) {
|
||||
timeoutInterval = 15.0;
|
||||
|
|
@ -132,6 +151,7 @@ static NSString *const kCompletedCallbackKey = @"completed";
|
|||
request.allHTTPHeaderFields = wself.HTTPHeaders;
|
||||
}
|
||||
operation = [[wself.operationClass alloc] initWithRequest:request
|
||||
inSession:self.session
|
||||
options:options
|
||||
progress:^(NSInteger receivedSize, NSInteger expectedSize) {
|
||||
SDWebImageDownloader *sself = wself;
|
||||
|
|
@ -141,8 +161,10 @@ static NSString *const kCompletedCallbackKey = @"completed";
|
|||
callbacksForURL = [sself.URLCallbacks[url] copy];
|
||||
});
|
||||
for (NSDictionary *callbacks in callbacksForURL) {
|
||||
SDWebImageDownloaderProgressBlock callback = callbacks[kProgressCallbackKey];
|
||||
if (callback) callback(receivedSize, expectedSize);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
SDWebImageDownloaderProgressBlock callback = callbacks[kProgressCallbackKey];
|
||||
if (callback) callback(receivedSize, expectedSize);
|
||||
});
|
||||
}
|
||||
}
|
||||
completed:^(UIImage *image, NSData *data, NSError *error, BOOL finished) {
|
||||
|
|
@ -169,7 +191,9 @@ static NSString *const kCompletedCallbackKey = @"completed";
|
|||
}];
|
||||
operation.shouldDecompressImages = wself.shouldDecompressImages;
|
||||
|
||||
if (wself.username && wself.password) {
|
||||
if (wself.urlCredential) {
|
||||
operation.credential = wself.urlCredential;
|
||||
} else if (wself.username && wself.password) {
|
||||
operation.credential = [NSURLCredential credentialWithUser:wself.username password:wself.password persistence:NSURLCredentialPersistenceForSession];
|
||||
}
|
||||
|
||||
|
|
@ -190,7 +214,7 @@ static NSString *const kCompletedCallbackKey = @"completed";
|
|||
return operation;
|
||||
}
|
||||
|
||||
- (void)addProgressCallback:(SDWebImageDownloaderProgressBlock)progressBlock andCompletedBlock:(SDWebImageDownloaderCompletedBlock)completedBlock forURL:(NSURL *)url createCallback:(SDWebImageNoParamsBlock)createCallback {
|
||||
- (void)addProgressCallback:(SDWebImageDownloaderProgressBlock)progressBlock completedBlock:(SDWebImageDownloaderCompletedBlock)completedBlock forURL:(NSURL *)url createCallback:(SDWebImageNoParamsBlock)createCallback {
|
||||
// The URL will be used as the key to the callbacks dictionary so it cannot be nil. If it is nil immediately call the completed block with no image or data.
|
||||
if (url == nil) {
|
||||
if (completedBlock != nil) {
|
||||
|
|
@ -224,4 +248,70 @@ static NSString *const kCompletedCallbackKey = @"completed";
|
|||
[self.downloadQueue setSuspended:suspended];
|
||||
}
|
||||
|
||||
- (void)cancelAllDownloads {
|
||||
[self.downloadQueue cancelAllOperations];
|
||||
}
|
||||
|
||||
#pragma mark Helper methods
|
||||
|
||||
- (SDWebImageDownloaderOperation *)operationWithTask:(NSURLSessionTask *)task {
|
||||
SDWebImageDownloaderOperation *returnOperation = nil;
|
||||
for (SDWebImageDownloaderOperation *operation in self.downloadQueue.operations) {
|
||||
if (operation.dataTask.taskIdentifier == task.taskIdentifier) {
|
||||
returnOperation = operation;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return returnOperation;
|
||||
}
|
||||
|
||||
#pragma mark NSURLSessionDataDelegate
|
||||
|
||||
- (void)URLSession:(NSURLSession *)session
|
||||
dataTask:(NSURLSessionDataTask *)dataTask
|
||||
didReceiveResponse:(NSURLResponse *)response
|
||||
completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler {
|
||||
|
||||
// Identify the operation that runs this task and pass it the delegate method
|
||||
SDWebImageDownloaderOperation *dataOperation = [self operationWithTask:dataTask];
|
||||
|
||||
[dataOperation URLSession:session dataTask:dataTask didReceiveResponse:response completionHandler:completionHandler];
|
||||
}
|
||||
|
||||
- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data {
|
||||
|
||||
// Identify the operation that runs this task and pass it the delegate method
|
||||
SDWebImageDownloaderOperation *dataOperation = [self operationWithTask:dataTask];
|
||||
|
||||
[dataOperation URLSession:session dataTask:dataTask didReceiveData:data];
|
||||
}
|
||||
|
||||
- (void)URLSession:(NSURLSession *)session
|
||||
dataTask:(NSURLSessionDataTask *)dataTask
|
||||
willCacheResponse:(NSCachedURLResponse *)proposedResponse
|
||||
completionHandler:(void (^)(NSCachedURLResponse *cachedResponse))completionHandler {
|
||||
|
||||
// Identify the operation that runs this task and pass it the delegate method
|
||||
SDWebImageDownloaderOperation *dataOperation = [self operationWithTask:dataTask];
|
||||
|
||||
[dataOperation URLSession:session dataTask:dataTask willCacheResponse:proposedResponse completionHandler:completionHandler];
|
||||
}
|
||||
|
||||
#pragma mark NSURLSessionTaskDelegate
|
||||
|
||||
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error {
|
||||
// Identify the operation that runs this task and pass it the delegate method
|
||||
SDWebImageDownloaderOperation *dataOperation = [self operationWithTask:task];
|
||||
|
||||
[dataOperation URLSession:session task:task didCompleteWithError:error];
|
||||
}
|
||||
|
||||
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler {
|
||||
|
||||
// Identify the operation that runs this task and pass it the delegate method
|
||||
SDWebImageDownloaderOperation *dataOperation = [self operationWithTask:task];
|
||||
|
||||
[dataOperation URLSession:session task:task didReceiveChallenge:challenge completionHandler:completionHandler];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -10,22 +10,31 @@
|
|||
#import "SDWebImageDownloader.h"
|
||||
#import "SDWebImageOperation.h"
|
||||
|
||||
@interface SDWebImageDownloaderOperation : NSOperation <SDWebImageOperation>
|
||||
extern NSString *const SDWebImageDownloadStartNotification;
|
||||
extern NSString *const SDWebImageDownloadReceiveResponseNotification;
|
||||
extern NSString *const SDWebImageDownloadStopNotification;
|
||||
extern NSString *const SDWebImageDownloadFinishNotification;
|
||||
|
||||
@interface SDWebImageDownloaderOperation : NSOperation <SDWebImageOperation, NSURLSessionTaskDelegate, NSURLSessionDataDelegate>
|
||||
|
||||
/**
|
||||
* The request used by the operation's connection.
|
||||
* The request used by the operation's task.
|
||||
*/
|
||||
@property (strong, nonatomic, readonly) NSURLRequest *request;
|
||||
|
||||
/**
|
||||
* The operation's task
|
||||
*/
|
||||
@property (strong, nonatomic, readonly) NSURLSessionTask *dataTask;
|
||||
|
||||
|
||||
@property (assign, nonatomic) BOOL shouldDecompressImages;
|
||||
|
||||
/**
|
||||
* Whether the URL connection should consult the credential storage for authenticating the connection. `YES` by default.
|
||||
*
|
||||
* This is the value that is returned in the `NSURLConnectionDelegate` method `-connectionShouldUseCredentialStorage:`.
|
||||
* Was used to determine whether the URL connection should consult the credential storage for authenticating the connection.
|
||||
* @deprecated Not used for a couple of versions
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL shouldUseCredentialStorage;
|
||||
@property (nonatomic, assign) BOOL shouldUseCredentialStorage __deprecated_msg("Property deprecated. Does nothing. Kept only for backwards compatibility");
|
||||
|
||||
/**
|
||||
* The credential used for authentication challenges in `-connection:didReceiveAuthenticationChallenge:`.
|
||||
|
|
@ -39,12 +48,23 @@
|
|||
*/
|
||||
@property (assign, nonatomic, readonly) SDWebImageDownloaderOptions options;
|
||||
|
||||
/**
|
||||
* The expected size of data.
|
||||
*/
|
||||
@property (assign, nonatomic) NSInteger expectedSize;
|
||||
|
||||
/**
|
||||
* The response returned by the operation's connection.
|
||||
*/
|
||||
@property (strong, nonatomic) NSURLResponse *response;
|
||||
|
||||
/**
|
||||
* Initializes a `SDWebImageDownloaderOperation` object
|
||||
*
|
||||
* @see SDWebImageDownloaderOperation
|
||||
*
|
||||
* @param request the URL request
|
||||
* @param session the URL session in which this operation will run
|
||||
* @param options downloader options
|
||||
* @param progressBlock the block executed when a new chunk of data arrives.
|
||||
* @note the progress block is executed on a background queue
|
||||
|
|
@ -55,9 +75,32 @@
|
|||
* @return the initialized instance
|
||||
*/
|
||||
- (id)initWithRequest:(NSURLRequest *)request
|
||||
inSession:(NSURLSession *)session
|
||||
options:(SDWebImageDownloaderOptions)options
|
||||
progress:(SDWebImageDownloaderProgressBlock)progressBlock
|
||||
completed:(SDWebImageDownloaderCompletedBlock)completedBlock
|
||||
cancelled:(SDWebImageNoParamsBlock)cancelBlock;
|
||||
|
||||
/**
|
||||
* Initializes a `SDWebImageDownloaderOperation` object
|
||||
*
|
||||
* @see SDWebImageDownloaderOperation
|
||||
*
|
||||
* @param request the URL request
|
||||
* @param options downloader options
|
||||
* @param progressBlock the block executed when a new chunk of data arrives.
|
||||
* @note the progress block is executed on a background queue
|
||||
* @param completedBlock the block executed when the download is done.
|
||||
* @note the completed block is executed on the main queue for success. If errors are found, there is a chance the block will be executed on a background queue
|
||||
* @param cancelBlock the block executed if the download (operation) is cancelled
|
||||
*
|
||||
* @return the initialized instance. The operation will run in a separate session created for this operation
|
||||
*/
|
||||
- (id)initWithRequest:(NSURLRequest *)request
|
||||
options:(SDWebImageDownloaderOptions)options
|
||||
progress:(SDWebImageDownloaderProgressBlock)progressBlock
|
||||
completed:(SDWebImageDownloaderCompletedBlock)completedBlock
|
||||
cancelled:(SDWebImageNoParamsBlock)cancelBlock
|
||||
__deprecated_msg("Method deprecated. Use `initWithRequest:inSession:options:progress:completed:cancelled`");
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -12,7 +12,12 @@
|
|||
#import <ImageIO/ImageIO.h>
|
||||
#import "SDWebImageManager.h"
|
||||
|
||||
@interface SDWebImageDownloaderOperation () <NSURLConnectionDataDelegate>
|
||||
NSString *const SDWebImageDownloadStartNotification = @"SDWebImageDownloadStartNotification";
|
||||
NSString *const SDWebImageDownloadReceiveResponseNotification = @"SDWebImageDownloadReceiveResponseNotification";
|
||||
NSString *const SDWebImageDownloadStopNotification = @"SDWebImageDownloadStopNotification";
|
||||
NSString *const SDWebImageDownloadFinishNotification = @"SDWebImageDownloadFinishNotification";
|
||||
|
||||
@interface SDWebImageDownloaderOperation ()
|
||||
|
||||
@property (copy, nonatomic) SDWebImageDownloaderProgressBlock progressBlock;
|
||||
@property (copy, nonatomic) SDWebImageDownloaderCompletedBlock completedBlock;
|
||||
|
|
@ -20,9 +25,16 @@
|
|||
|
||||
@property (assign, nonatomic, getter = isExecuting) BOOL executing;
|
||||
@property (assign, nonatomic, getter = isFinished) BOOL finished;
|
||||
@property (assign, nonatomic) NSInteger expectedSize;
|
||||
@property (strong, nonatomic) NSMutableData *imageData;
|
||||
@property (strong, nonatomic) NSURLConnection *connection;
|
||||
|
||||
// This is weak because it is injected by whoever manages this session. If this gets nil-ed out, we won't be able to run
|
||||
// the task associated with this operation
|
||||
@property (weak, nonatomic) NSURLSession *unownedSession;
|
||||
// This is set if we're using not using an injected NSURLSession. We're responsible of invalidating this one
|
||||
@property (strong, nonatomic) NSURLSession *ownedSession;
|
||||
|
||||
@property (strong, nonatomic, readwrite) NSURLSessionTask *dataTask;
|
||||
|
||||
@property (strong, atomic) NSThread *thread;
|
||||
|
||||
#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
|
||||
|
|
@ -45,10 +57,24 @@
|
|||
progress:(SDWebImageDownloaderProgressBlock)progressBlock
|
||||
completed:(SDWebImageDownloaderCompletedBlock)completedBlock
|
||||
cancelled:(SDWebImageNoParamsBlock)cancelBlock {
|
||||
|
||||
return [self initWithRequest:request
|
||||
inSession:nil
|
||||
options:options
|
||||
progress:progressBlock
|
||||
completed:completedBlock
|
||||
cancelled:cancelBlock];
|
||||
}
|
||||
|
||||
- (id)initWithRequest:(NSURLRequest *)request
|
||||
inSession:(NSURLSession *)session
|
||||
options:(SDWebImageDownloaderOptions)options
|
||||
progress:(SDWebImageDownloaderProgressBlock)progressBlock
|
||||
completed:(SDWebImageDownloaderCompletedBlock)completedBlock
|
||||
cancelled:(SDWebImageNoParamsBlock)cancelBlock {
|
||||
if ((self = [super init])) {
|
||||
_request = request;
|
||||
_shouldDecompressImages = YES;
|
||||
_shouldUseCredentialStorage = YES;
|
||||
_options = options;
|
||||
_progressBlock = [progressBlock copy];
|
||||
_completedBlock = [completedBlock copy];
|
||||
|
|
@ -56,7 +82,8 @@
|
|||
_executing = NO;
|
||||
_finished = NO;
|
||||
_expectedSize = 0;
|
||||
responseFromCached = YES; // Initially wrong until `connection:willCacheResponse:` is called or not called
|
||||
_unownedSession = session;
|
||||
responseFromCached = YES; // Initially wrong until `- URLSession:dataTask:willCacheResponse:completionHandler: is called or not called
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
|
@ -70,50 +97,53 @@
|
|||
}
|
||||
|
||||
#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
|
||||
if ([self shouldContinueWhenAppEntersBackground]) {
|
||||
Class UIApplicationClass = NSClassFromString(@"UIApplication");
|
||||
BOOL hasApplication = UIApplicationClass && [UIApplicationClass respondsToSelector:@selector(sharedApplication)];
|
||||
if (hasApplication && [self shouldContinueWhenAppEntersBackground]) {
|
||||
__weak __typeof__ (self) wself = self;
|
||||
self.backgroundTaskId = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
|
||||
UIApplication * app = [UIApplicationClass performSelector:@selector(sharedApplication)];
|
||||
self.backgroundTaskId = [app beginBackgroundTaskWithExpirationHandler:^{
|
||||
__strong __typeof (wself) sself = wself;
|
||||
|
||||
if (sself) {
|
||||
[sself cancel];
|
||||
|
||||
[[UIApplication sharedApplication] endBackgroundTask:sself.backgroundTaskId];
|
||||
[app endBackgroundTask:sself.backgroundTaskId];
|
||||
sself.backgroundTaskId = UIBackgroundTaskInvalid;
|
||||
}
|
||||
}];
|
||||
}
|
||||
#endif
|
||||
|
||||
NSURLSession *session = self.unownedSession;
|
||||
if (!self.unownedSession) {
|
||||
NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration];
|
||||
sessionConfig.timeoutIntervalForRequest = 15;
|
||||
|
||||
/**
|
||||
* Create the session for this task
|
||||
* We send nil as delegate queue so that the session creates a serial operation queue for performing all delegate
|
||||
* method calls and completion handler calls.
|
||||
*/
|
||||
self.ownedSession = [NSURLSession sessionWithConfiguration:sessionConfig
|
||||
delegate:self
|
||||
delegateQueue:nil];
|
||||
session = self.ownedSession;
|
||||
}
|
||||
|
||||
self.dataTask = [session dataTaskWithRequest:self.request];
|
||||
self.executing = YES;
|
||||
self.connection = [[NSURLConnection alloc] initWithRequest:self.request delegate:self startImmediately:NO];
|
||||
self.thread = [NSThread currentThread];
|
||||
}
|
||||
|
||||
[self.dataTask resume];
|
||||
|
||||
[self.connection start];
|
||||
|
||||
if (self.connection) {
|
||||
if (self.dataTask) {
|
||||
if (self.progressBlock) {
|
||||
self.progressBlock(0, NSURLResponseUnknownLength);
|
||||
}
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStartNotification object:self];
|
||||
});
|
||||
|
||||
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_5_1) {
|
||||
// Make sure to run the runloop in our background thread so it can process downloaded data
|
||||
// Note: we use a timeout to work around an issue with NSURLConnection cancel under iOS 5
|
||||
// not waking up the runloop, leading to dead threads (see https://github.com/rs/SDWebImage/issues/466)
|
||||
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 10, false);
|
||||
}
|
||||
else {
|
||||
CFRunLoopRun();
|
||||
}
|
||||
|
||||
if (!self.isFinished) {
|
||||
[self.connection cancel];
|
||||
[self connection:self.connection didFailWithError:[NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorTimedOut userInfo:@{NSURLErrorFailingURLErrorKey : self.request.URL}]];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (self.completedBlock) {
|
||||
|
|
@ -122,8 +152,13 @@
|
|||
}
|
||||
|
||||
#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
|
||||
Class UIApplicationClass = NSClassFromString(@"UIApplication");
|
||||
if(!UIApplicationClass || ![UIApplicationClass respondsToSelector:@selector(sharedApplication)]) {
|
||||
return;
|
||||
}
|
||||
if (self.backgroundTaskId != UIBackgroundTaskInvalid) {
|
||||
[[UIApplication sharedApplication] endBackgroundTask:self.backgroundTaskId];
|
||||
UIApplication * app = [UIApplication performSelector:@selector(sharedApplication)];
|
||||
[app endBackgroundTask:self.backgroundTaskId];
|
||||
self.backgroundTaskId = UIBackgroundTaskInvalid;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -143,7 +178,6 @@
|
|||
- (void)cancelInternalAndStop {
|
||||
if (self.isFinished) return;
|
||||
[self cancelInternal];
|
||||
CFRunLoopStop(CFRunLoopGetCurrent());
|
||||
}
|
||||
|
||||
- (void)cancelInternal {
|
||||
|
|
@ -151,8 +185,8 @@
|
|||
[super cancel];
|
||||
if (self.cancelBlock) self.cancelBlock();
|
||||
|
||||
if (self.connection) {
|
||||
[self.connection cancel];
|
||||
if (self.dataTask) {
|
||||
[self.dataTask cancel];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:self];
|
||||
});
|
||||
|
|
@ -176,9 +210,13 @@
|
|||
self.cancelBlock = nil;
|
||||
self.completedBlock = nil;
|
||||
self.progressBlock = nil;
|
||||
self.connection = nil;
|
||||
self.dataTask = nil;
|
||||
self.imageData = nil;
|
||||
self.thread = nil;
|
||||
if (self.ownedSession) {
|
||||
[self.ownedSession invalidateAndCancel];
|
||||
self.ownedSession = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setFinished:(BOOL)finished {
|
||||
|
|
@ -197,19 +235,26 @@
|
|||
return YES;
|
||||
}
|
||||
|
||||
#pragma mark NSURLConnection (delegate)
|
||||
#pragma mark NSURLSessionDataDelegate
|
||||
|
||||
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
|
||||
- (void)URLSession:(NSURLSession *)session
|
||||
dataTask:(NSURLSessionDataTask *)dataTask
|
||||
didReceiveResponse:(NSURLResponse *)response
|
||||
completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler {
|
||||
|
||||
//'304 Not Modified' is an exceptional one
|
||||
if ((![response respondsToSelector:@selector(statusCode)] || [((NSHTTPURLResponse *)response) statusCode] < 400) && [((NSHTTPURLResponse *)response) statusCode] != 304) {
|
||||
if (![response respondsToSelector:@selector(statusCode)] || ([((NSHTTPURLResponse *)response) statusCode] < 400 && [((NSHTTPURLResponse *)response) statusCode] != 304)) {
|
||||
NSInteger expected = response.expectedContentLength > 0 ? (NSInteger)response.expectedContentLength : 0;
|
||||
self.expectedSize = expected;
|
||||
if (self.progressBlock) {
|
||||
self.progressBlock(0, expected);
|
||||
}
|
||||
|
||||
|
||||
self.imageData = [[NSMutableData alloc] initWithCapacity:expected];
|
||||
self.response = response;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadReceiveResponseNotification object:self];
|
||||
});
|
||||
}
|
||||
else {
|
||||
NSUInteger code = [((NSHTTPURLResponse *)response) statusCode];
|
||||
|
|
@ -219,21 +264,24 @@
|
|||
if (code == 304) {
|
||||
[self cancelInternal];
|
||||
} else {
|
||||
[self.connection cancel];
|
||||
[self.dataTask cancel];
|
||||
}
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:nil];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:self];
|
||||
});
|
||||
|
||||
|
||||
if (self.completedBlock) {
|
||||
self.completedBlock(nil, nil, [NSError errorWithDomain:NSURLErrorDomain code:[((NSHTTPURLResponse *)response) statusCode] userInfo:nil], YES);
|
||||
}
|
||||
CFRunLoopStop(CFRunLoopGetCurrent());
|
||||
[self done];
|
||||
}
|
||||
|
||||
if (completionHandler) {
|
||||
completionHandler(NSURLSessionResponseAllow);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
|
||||
- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data {
|
||||
[self.imageData appendData:data];
|
||||
|
||||
if ((self.options & SDWebImageDownloaderProgressiveDownload) && self.expectedSize > 0 && self.completedBlock) {
|
||||
|
|
@ -261,7 +309,7 @@
|
|||
// When we draw to Core Graphics, we lose orientation information,
|
||||
// which means the image below born of initWithCGIImage will be
|
||||
// oriented incorrectly sometimes. (Unlike the image born of initWithData
|
||||
// in connectionDidFinishLoading.) So save it here and pass it on later.
|
||||
// in didCompleteWithError.) So save it here and pass it on later.
|
||||
orientation = [[self class] orientationFromPropertyValue:(orientationValue == -1 ? 1 : orientationValue)];
|
||||
}
|
||||
|
||||
|
|
@ -318,6 +366,110 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void)URLSession:(NSURLSession *)session
|
||||
dataTask:(NSURLSessionDataTask *)dataTask
|
||||
willCacheResponse:(NSCachedURLResponse *)proposedResponse
|
||||
completionHandler:(void (^)(NSCachedURLResponse *cachedResponse))completionHandler {
|
||||
|
||||
responseFromCached = NO; // If this method is called, it means the response wasn't read from cache
|
||||
NSCachedURLResponse *cachedResponse = proposedResponse;
|
||||
|
||||
if (self.request.cachePolicy == NSURLRequestReloadIgnoringLocalCacheData) {
|
||||
// Prevents caching of responses
|
||||
cachedResponse = nil;
|
||||
}
|
||||
if (completionHandler) {
|
||||
completionHandler(cachedResponse);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark NSURLSessionTaskDelegate
|
||||
|
||||
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error {
|
||||
@synchronized(self) {
|
||||
self.thread = nil;
|
||||
self.dataTask = nil;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:self];
|
||||
if (!error) {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadFinishNotification object:self];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (error) {
|
||||
if (self.completedBlock) {
|
||||
self.completedBlock(nil, nil, error, YES);
|
||||
}
|
||||
} else {
|
||||
SDWebImageDownloaderCompletedBlock completionBlock = self.completedBlock;
|
||||
|
||||
if (![[NSURLCache sharedURLCache] cachedResponseForRequest:_request]) {
|
||||
responseFromCached = NO;
|
||||
}
|
||||
|
||||
if (completionBlock) {
|
||||
if (self.options & SDWebImageDownloaderIgnoreCachedResponse && responseFromCached) {
|
||||
completionBlock(nil, nil, nil, YES);
|
||||
} else if (self.imageData) {
|
||||
UIImage *image = [UIImage sd_imageWithData:self.imageData];
|
||||
NSString *key = [[SDWebImageManager sharedManager] cacheKeyForURL:self.request.URL];
|
||||
image = [self scaledImageForKey:key image:image];
|
||||
|
||||
// Do not force decoding animated GIFs
|
||||
if (!image.images) {
|
||||
if (self.shouldDecompressImages) {
|
||||
image = [UIImage decodedImageWithImage:image];
|
||||
}
|
||||
}
|
||||
if (CGSizeEqualToSize(image.size, CGSizeZero)) {
|
||||
completionBlock(nil, nil, [NSError errorWithDomain:SDWebImageErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey : @"Downloaded image has 0 pixels"}], YES);
|
||||
}
|
||||
else {
|
||||
completionBlock(image, self.imageData, nil, YES);
|
||||
}
|
||||
} else {
|
||||
completionBlock(nil, nil, [NSError errorWithDomain:SDWebImageErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey : @"Image data is nil"}], YES);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.completionBlock = nil;
|
||||
[self done];
|
||||
}
|
||||
|
||||
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler {
|
||||
|
||||
NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling;
|
||||
__block NSURLCredential *credential = nil;
|
||||
|
||||
if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
|
||||
if (!(self.options & SDWebImageDownloaderAllowInvalidSSLCertificates)) {
|
||||
disposition = NSURLSessionAuthChallengePerformDefaultHandling;
|
||||
} else {
|
||||
credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];
|
||||
disposition = NSURLSessionAuthChallengeUseCredential;
|
||||
}
|
||||
} else {
|
||||
if ([challenge previousFailureCount] == 0) {
|
||||
if (self.credential) {
|
||||
credential = self.credential;
|
||||
disposition = NSURLSessionAuthChallengeUseCredential;
|
||||
} else {
|
||||
disposition = NSURLSessionAuthChallengeCancelAuthenticationChallenge;
|
||||
}
|
||||
} else {
|
||||
disposition = NSURLSessionAuthChallengeCancelAuthenticationChallenge;
|
||||
}
|
||||
}
|
||||
|
||||
if (completionHandler) {
|
||||
completionHandler(disposition, credential);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark Helper methods
|
||||
|
||||
+ (UIImageOrientation)orientationFromPropertyValue:(NSInteger)value {
|
||||
switch (value) {
|
||||
case 1:
|
||||
|
|
@ -345,104 +497,8 @@
|
|||
return SDScaledImageForKey(key, image);
|
||||
}
|
||||
|
||||
- (void)connectionDidFinishLoading:(NSURLConnection *)aConnection {
|
||||
SDWebImageDownloaderCompletedBlock completionBlock = self.completedBlock;
|
||||
@synchronized(self) {
|
||||
CFRunLoopStop(CFRunLoopGetCurrent());
|
||||
self.thread = nil;
|
||||
self.connection = nil;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:nil];
|
||||
});
|
||||
}
|
||||
|
||||
if (![[NSURLCache sharedURLCache] cachedResponseForRequest:_request]) {
|
||||
responseFromCached = NO;
|
||||
}
|
||||
|
||||
if (completionBlock) {
|
||||
if (self.options & SDWebImageDownloaderIgnoreCachedResponse && responseFromCached) {
|
||||
completionBlock(nil, nil, nil, YES);
|
||||
}
|
||||
else {
|
||||
UIImage *image = [UIImage sd_imageWithData:self.imageData];
|
||||
NSString *key = [[SDWebImageManager sharedManager] cacheKeyForURL:self.request.URL];
|
||||
image = [self scaledImageForKey:key image:image];
|
||||
|
||||
// Do not force decoding animated GIFs
|
||||
if (!image.images) {
|
||||
if (self.shouldDecompressImages) {
|
||||
image = [UIImage decodedImageWithImage:image];
|
||||
}
|
||||
}
|
||||
if (CGSizeEqualToSize(image.size, CGSizeZero)) {
|
||||
completionBlock(nil, nil, [NSError errorWithDomain:@"SDWebImageErrorDomain" code:0 userInfo:@{NSLocalizedDescriptionKey : @"Downloaded image has 0 pixels"}], YES);
|
||||
}
|
||||
else {
|
||||
completionBlock(image, self.imageData, nil, YES);
|
||||
}
|
||||
}
|
||||
}
|
||||
self.completionBlock = nil;
|
||||
[self done];
|
||||
}
|
||||
|
||||
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
|
||||
@synchronized(self) {
|
||||
CFRunLoopStop(CFRunLoopGetCurrent());
|
||||
self.thread = nil;
|
||||
self.connection = nil;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:nil];
|
||||
});
|
||||
}
|
||||
|
||||
if (self.completedBlock) {
|
||||
self.completedBlock(nil, nil, error, YES);
|
||||
}
|
||||
self.completionBlock = nil;
|
||||
[self done];
|
||||
}
|
||||
|
||||
- (NSCachedURLResponse *)connection:(NSURLConnection *)connection willCacheResponse:(NSCachedURLResponse *)cachedResponse {
|
||||
responseFromCached = NO; // If this method is called, it means the response wasn't read from cache
|
||||
if (self.request.cachePolicy == NSURLRequestReloadIgnoringLocalCacheData) {
|
||||
// Prevents caching of responses
|
||||
return nil;
|
||||
}
|
||||
else {
|
||||
return cachedResponse;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)shouldContinueWhenAppEntersBackground {
|
||||
return self.options & SDWebImageDownloaderContinueInBackground;
|
||||
}
|
||||
|
||||
- (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection __unused *)connection {
|
||||
return self.shouldUseCredentialStorage;
|
||||
}
|
||||
|
||||
- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge{
|
||||
if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
|
||||
if (!(self.options & SDWebImageDownloaderAllowInvalidSSLCertificates) &&
|
||||
[challenge.sender respondsToSelector:@selector(performDefaultHandlingForAuthenticationChallenge:)]) {
|
||||
[challenge.sender performDefaultHandlingForAuthenticationChallenge:challenge];
|
||||
} else {
|
||||
NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];
|
||||
[[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
|
||||
}
|
||||
} else {
|
||||
if ([challenge previousFailureCount] == 0) {
|
||||
if (self.credential) {
|
||||
[[challenge sender] useCredential:self.credential forAuthenticationChallenge:challenge];
|
||||
} else {
|
||||
[[challenge sender] continueWithoutCredentialForAuthenticationChallenge:challenge];
|
||||
}
|
||||
} else {
|
||||
[[challenge sender] continueWithoutCredentialForAuthenticationChallenge:challenge];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ typedef NS_OPTIONS(NSUInteger, SDWebImageOptions) {
|
|||
* This option helps deal with images changing behind the same request URL, e.g. Facebook graph api profile pics.
|
||||
* If a cached image is refreshed, the completion block is called once with the cached image and again with the final image.
|
||||
*
|
||||
* Use this flag only if you can't make your URLs static with embeded cache busting parameter.
|
||||
* Use this flag only if you can't make your URLs static with embedded cache busting parameter.
|
||||
*/
|
||||
SDWebImageRefreshCached = 1 << 4,
|
||||
|
||||
|
|
@ -58,15 +58,14 @@ typedef NS_OPTIONS(NSUInteger, SDWebImageOptions) {
|
|||
SDWebImageHandleCookies = 1 << 6,
|
||||
|
||||
/**
|
||||
* Enable to allow untrusted SSL ceriticates.
|
||||
* Enable to allow untrusted SSL certificates.
|
||||
* Useful for testing purposes. Use with caution in production.
|
||||
*/
|
||||
SDWebImageAllowInvalidSSLCertificates = 1 << 7,
|
||||
|
||||
/**
|
||||
* By default, image are loaded in the order they were queued. This flag move them to
|
||||
* the front of the queue and is loaded immediately instead of waiting for the current queue to be loaded (which
|
||||
* could take a while).
|
||||
* By default, images are loaded in the order in which they were queued. This flag moves them to
|
||||
* the front of the queue.
|
||||
*/
|
||||
SDWebImageHighPriority = 1 << 8,
|
||||
|
||||
|
|
@ -82,6 +81,13 @@ typedef NS_OPTIONS(NSUInteger, SDWebImageOptions) {
|
|||
* Use this flag to transform them anyway.
|
||||
*/
|
||||
SDWebImageTransformAnimatedImage = 1 << 10,
|
||||
|
||||
/**
|
||||
* By default, image is added to the imageView after download. But in some cases, we want to
|
||||
* have the hand before setting the image (apply a filter or add it with cross-fade animation for instance)
|
||||
* Use this flag if you want to manually set the image in the completion when success
|
||||
*/
|
||||
SDWebImageAvoidAutoSetImage = 1 << 11
|
||||
};
|
||||
|
||||
typedef void(^SDWebImageCompletionBlock)(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL);
|
||||
|
|
@ -132,14 +138,14 @@ typedef NSString *(^SDWebImageCacheKeyFilterBlock)(NSURL *url);
|
|||
* @code
|
||||
|
||||
SDWebImageManager *manager = [SDWebImageManager sharedManager];
|
||||
[manager downloadWithURL:imageURL
|
||||
options:0
|
||||
progress:nil
|
||||
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
|
||||
if (image) {
|
||||
// do something with image
|
||||
}
|
||||
}];
|
||||
[manager downloadImageWithURL:imageURL
|
||||
options:0
|
||||
progress:nil
|
||||
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
|
||||
if (image) {
|
||||
// do something with image
|
||||
}
|
||||
}];
|
||||
|
||||
* @endcode
|
||||
*/
|
||||
|
|
@ -175,6 +181,12 @@ SDWebImageManager *manager = [SDWebImageManager sharedManager];
|
|||
*/
|
||||
+ (SDWebImageManager *)sharedManager;
|
||||
|
||||
/**
|
||||
* Allows to specify instance of cache and image downloader used with image manager.
|
||||
* @return new instance of `SDWebImageManager` with specified cache and downloader.
|
||||
*/
|
||||
- (instancetype)initWithCache:(SDImageCache *)cache downloader:(SDWebImageDownloader *)downloader;
|
||||
|
||||
/**
|
||||
* Downloads the image at the given URL if not present in cache or return the cached version otherwise.
|
||||
*
|
||||
|
|
@ -188,11 +200,11 @@ SDWebImageManager *manager = [SDWebImageManager sharedManager];
|
|||
* This block has no return value and takes the requested UIImage as first parameter.
|
||||
* In case of error the image parameter is nil and the second parameter may contain an NSError.
|
||||
*
|
||||
* The third parameter is an `SDImageCacheType` enum indicating if the image was retrived from the local cache
|
||||
* The third parameter is an `SDImageCacheType` enum indicating if the image was retrieved from the local cache
|
||||
* or from the memory cache or from the network.
|
||||
*
|
||||
* The last parameter is set to NO when the SDWebImageProgressiveDownload option is used and the image is
|
||||
* downloading. This block is thus called repetidly with a partial image. When image is fully downloaded, the
|
||||
* downloading. This block is thus called repeatedly with a partial image. When image is fully downloaded, the
|
||||
* block is called a last time with the full image and the last parameter set to YES.
|
||||
*
|
||||
* @return Returns an NSObject conforming to SDWebImageOperation. Should be an instance of SDWebImageDownloaderOperation
|
||||
|
|
@ -213,7 +225,7 @@ SDWebImageManager *manager = [SDWebImageManager sharedManager];
|
|||
- (void)saveImageToCache:(UIImage *)image forURL:(NSURL *)url;
|
||||
|
||||
/**
|
||||
* Cancel all current opreations
|
||||
* Cancel all current operations
|
||||
*/
|
||||
- (void)cancelAll;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
@property (strong, nonatomic, readwrite) SDImageCache *imageCache;
|
||||
@property (strong, nonatomic, readwrite) SDWebImageDownloader *imageDownloader;
|
||||
@property (strong, nonatomic) NSMutableArray *failedURLs;
|
||||
@property (strong, nonatomic) NSMutableSet *failedURLs;
|
||||
@property (strong, nonatomic) NSMutableArray *runningOperations;
|
||||
|
||||
@end
|
||||
|
|
@ -37,25 +37,30 @@
|
|||
return instance;
|
||||
}
|
||||
|
||||
- (id)init {
|
||||
- (instancetype)init {
|
||||
SDImageCache *cache = [SDImageCache sharedImageCache];
|
||||
SDWebImageDownloader *downloader = [SDWebImageDownloader sharedDownloader];
|
||||
return [self initWithCache:cache downloader:downloader];
|
||||
}
|
||||
|
||||
- (instancetype)initWithCache:(SDImageCache *)cache downloader:(SDWebImageDownloader *)downloader {
|
||||
if ((self = [super init])) {
|
||||
_imageCache = [self createCache];
|
||||
_imageDownloader = [SDWebImageDownloader sharedDownloader];
|
||||
_failedURLs = [NSMutableArray new];
|
||||
_imageCache = cache;
|
||||
_imageDownloader = downloader;
|
||||
_failedURLs = [NSMutableSet new];
|
||||
_runningOperations = [NSMutableArray new];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (SDImageCache *)createCache {
|
||||
return [SDImageCache sharedImageCache];
|
||||
}
|
||||
|
||||
- (NSString *)cacheKeyForURL:(NSURL *)url {
|
||||
if (!url) {
|
||||
return @"";
|
||||
}
|
||||
|
||||
if (self.cacheKeyFilter) {
|
||||
return self.cacheKeyFilter(url);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return [url absoluteString];
|
||||
}
|
||||
}
|
||||
|
|
@ -133,7 +138,7 @@
|
|||
isFailedUrl = [self.failedURLs containsObject:url];
|
||||
}
|
||||
|
||||
if (!url || (!(options & SDWebImageRetryFailed) && isFailedUrl)) {
|
||||
if (url.absoluteString.length == 0 || (!(options & SDWebImageRetryFailed) && isFailedUrl)) {
|
||||
dispatch_main_sync_safe(^{
|
||||
NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorFileDoesNotExist userInfo:nil];
|
||||
completedBlock(nil, error, SDImageCacheTypeNone, YES, url);
|
||||
|
|
@ -158,7 +163,7 @@
|
|||
if ((!image || options & SDWebImageRefreshCached) && (![self.delegate respondsToSelector:@selector(imageManager:shouldDownloadImageForURL:)] || [self.delegate imageManager:self shouldDownloadImageForURL:url])) {
|
||||
if (image && options & SDWebImageRefreshCached) {
|
||||
dispatch_main_sync_safe(^{
|
||||
// If image was found in the cache bug SDWebImageRefreshCached is provided, notify about the cached image
|
||||
// If image was found in the cache but SDWebImageRefreshCached is provided, notify about the cached image
|
||||
// AND try to re-download it in order to let a chance to NSURLCache to refresh it from server.
|
||||
completedBlock(image, nil, cacheType, YES, url);
|
||||
});
|
||||
|
|
@ -180,27 +185,38 @@
|
|||
downloaderOptions |= SDWebImageDownloaderIgnoreCachedResponse;
|
||||
}
|
||||
id <SDWebImageOperation> subOperation = [self.imageDownloader downloadImageWithURL:url options:downloaderOptions progress:progressBlock completed:^(UIImage *downloadedImage, NSData *data, NSError *error, BOOL finished) {
|
||||
if (weakOperation.isCancelled) {
|
||||
__strong __typeof(weakOperation) strongOperation = weakOperation;
|
||||
if (!strongOperation || strongOperation.isCancelled) {
|
||||
// Do nothing if the operation was cancelled
|
||||
// See #699 for more details
|
||||
// if we would call the completedBlock, there could be a race condition between this block and another completedBlock for the same object, so if this one is called second, we will overwrite the new data
|
||||
}
|
||||
else if (error) {
|
||||
dispatch_main_sync_safe(^{
|
||||
if (!weakOperation.isCancelled) {
|
||||
if (strongOperation && !strongOperation.isCancelled) {
|
||||
completedBlock(nil, error, SDImageCacheTypeNone, finished, url);
|
||||
}
|
||||
});
|
||||
|
||||
if (error.code != NSURLErrorNotConnectedToInternet && error.code != NSURLErrorCancelled && error.code != NSURLErrorTimedOut) {
|
||||
if ( error.code != NSURLErrorNotConnectedToInternet
|
||||
&& error.code != NSURLErrorCancelled
|
||||
&& error.code != NSURLErrorTimedOut
|
||||
&& error.code != NSURLErrorInternationalRoamingOff
|
||||
&& error.code != NSURLErrorDataNotAllowed
|
||||
&& error.code != NSURLErrorCannotFindHost
|
||||
&& error.code != NSURLErrorCannotConnectToHost) {
|
||||
@synchronized (self.failedURLs) {
|
||||
if (![self.failedURLs containsObject:url]) {
|
||||
[self.failedURLs addObject:url];
|
||||
}
|
||||
[self.failedURLs addObject:url];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((options & SDWebImageRetryFailed)) {
|
||||
@synchronized (self.failedURLs) {
|
||||
[self.failedURLs removeObject:url];
|
||||
}
|
||||
}
|
||||
|
||||
BOOL cacheOnDisk = !(options & SDWebImageCacheMemoryOnly);
|
||||
|
||||
if (options & SDWebImageRefreshCached && image && !downloadedImage) {
|
||||
|
|
@ -212,11 +228,11 @@
|
|||
|
||||
if (transformedImage && finished) {
|
||||
BOOL imageWasTransformed = ![transformedImage isEqual:downloadedImage];
|
||||
[self.imageCache storeImage:transformedImage recalculateFromImage:imageWasTransformed imageData:data forKey:key toDisk:cacheOnDisk];
|
||||
[self.imageCache storeImage:transformedImage recalculateFromImage:imageWasTransformed imageData:(imageWasTransformed ? nil : data) forKey:key toDisk:cacheOnDisk];
|
||||
}
|
||||
|
||||
dispatch_main_sync_safe(^{
|
||||
if (!weakOperation.isCancelled) {
|
||||
if (strongOperation && !strongOperation.isCancelled) {
|
||||
completedBlock(transformedImage, nil, SDImageCacheTypeNone, finished, url);
|
||||
}
|
||||
});
|
||||
|
|
@ -228,7 +244,7 @@
|
|||
}
|
||||
|
||||
dispatch_main_sync_safe(^{
|
||||
if (!weakOperation.isCancelled) {
|
||||
if (strongOperation && !strongOperation.isCancelled) {
|
||||
completedBlock(downloadedImage, nil, SDImageCacheTypeNone, finished, url);
|
||||
}
|
||||
});
|
||||
|
|
@ -237,7 +253,9 @@
|
|||
|
||||
if (finished) {
|
||||
@synchronized (self.runningOperations) {
|
||||
[self.runningOperations removeObject:operation];
|
||||
if (strongOperation) {
|
||||
[self.runningOperations removeObject:strongOperation];
|
||||
}
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
|
@ -245,13 +263,17 @@
|
|||
[subOperation cancel];
|
||||
|
||||
@synchronized (self.runningOperations) {
|
||||
[self.runningOperations removeObject:weakOperation];
|
||||
__strong __typeof(weakOperation) strongOperation = weakOperation;
|
||||
if (strongOperation) {
|
||||
[self.runningOperations removeObject:strongOperation];
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
else if (image) {
|
||||
dispatch_main_sync_safe(^{
|
||||
if (!weakOperation.isCancelled) {
|
||||
__strong __typeof(weakOperation) strongOperation = weakOperation;
|
||||
if (strongOperation && !strongOperation.isCancelled) {
|
||||
completedBlock(image, nil, cacheType, YES, url);
|
||||
}
|
||||
});
|
||||
|
|
@ -262,7 +284,8 @@
|
|||
else {
|
||||
// Image not in cache and download disallowed by delegate
|
||||
dispatch_main_sync_safe(^{
|
||||
if (!weakOperation.isCancelled) {
|
||||
__strong __typeof(weakOperation) strongOperation = weakOperation;
|
||||
if (strongOperation && !weakOperation.isCancelled) {
|
||||
completedBlock(nil, nil, SDImageCacheTypeNone, YES, url);
|
||||
}
|
||||
});
|
||||
|
|
@ -291,7 +314,11 @@
|
|||
}
|
||||
|
||||
- (BOOL)isRunning {
|
||||
return self.runningOperations.count > 0;
|
||||
BOOL isRunning = NO;
|
||||
@synchronized(self.runningOperations) {
|
||||
isRunning = (self.runningOperations.count > 0);
|
||||
}
|
||||
return isRunning;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -70,6 +70,11 @@ typedef void(^SDWebImagePrefetcherCompletionBlock)(NSUInteger noOfFinishedUrls,
|
|||
*/
|
||||
+ (SDWebImagePrefetcher *)sharedImagePrefetcher;
|
||||
|
||||
/**
|
||||
* Allows you to instantiate a prefetcher with any arbitrary image manager.
|
||||
*/
|
||||
- (id)initWithImageManager:(SDWebImageManager *)manager;
|
||||
|
||||
/**
|
||||
* Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching,
|
||||
* currently one image is downloaded at a time,
|
||||
|
|
|
|||
|
|
@ -8,10 +8,6 @@
|
|||
|
||||
#import "SDWebImagePrefetcher.h"
|
||||
|
||||
#if (!defined(DEBUG) && !defined (SD_VERBOSE)) || defined(SD_LOG_NONE)
|
||||
#define NSLog(...)
|
||||
#endif
|
||||
|
||||
@interface SDWebImagePrefetcher ()
|
||||
|
||||
@property (strong, nonatomic) SDWebImageManager *manager;
|
||||
|
|
@ -37,8 +33,12 @@
|
|||
}
|
||||
|
||||
- (id)init {
|
||||
return [self initWithImageManager:[SDWebImageManager new]];
|
||||
}
|
||||
|
||||
- (id)initWithImageManager:(SDWebImageManager *)manager {
|
||||
if ((self = [super init])) {
|
||||
_manager = [SDWebImageManager new];
|
||||
_manager = manager;
|
||||
_options = SDWebImageLowPriority;
|
||||
_prefetcherQueue = dispatch_get_main_queue();
|
||||
self.maxConcurrentDownloads = 3;
|
||||
|
|
@ -65,14 +65,11 @@
|
|||
if (self.progressBlock) {
|
||||
self.progressBlock(self.finishedCount,[self.prefetchURLs count]);
|
||||
}
|
||||
NSLog(@"Prefetched %@ out of %@", @(self.finishedCount), @(self.prefetchURLs.count));
|
||||
}
|
||||
else {
|
||||
if (self.progressBlock) {
|
||||
self.progressBlock(self.finishedCount,[self.prefetchURLs count]);
|
||||
}
|
||||
NSLog(@"Prefetched %@ out of %@ (Failed)", @(self.finishedCount), @(self.prefetchURLs.count));
|
||||
|
||||
// Add last failed
|
||||
self.skippedCount++;
|
||||
}
|
||||
|
|
@ -81,31 +78,30 @@
|
|||
didPrefetchURL:self.prefetchURLs[index]
|
||||
finishedCount:self.finishedCount
|
||||
totalCount:self.prefetchURLs.count
|
||||
];
|
||||
];
|
||||
}
|
||||
if (self.prefetchURLs.count > self.requestedCount) {
|
||||
dispatch_async(self.prefetcherQueue, ^{
|
||||
[self startPrefetchingAtIndex:self.requestedCount];
|
||||
});
|
||||
}
|
||||
else if (self.finishedCount == self.requestedCount) {
|
||||
} else if (self.finishedCount == self.requestedCount) {
|
||||
[self reportStatus];
|
||||
if (self.completionBlock) {
|
||||
self.completionBlock(self.finishedCount, self.skippedCount);
|
||||
self.completionBlock = nil;
|
||||
}
|
||||
self.progressBlock = nil;
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)reportStatus {
|
||||
NSUInteger total = [self.prefetchURLs count];
|
||||
NSLog(@"Finished prefetching (%@ successful, %@ skipped, timeElasped %.2f)", @(total - self.skippedCount), @(self.skippedCount), CFAbsoluteTimeGetCurrent() - self.startedTime);
|
||||
if ([self.delegate respondsToSelector:@selector(imagePrefetcher:didFinishWithTotalCount:skippedCount:)]) {
|
||||
[self.delegate imagePrefetcher:self
|
||||
didFinishWithTotalCount:(total - self.skippedCount)
|
||||
skippedCount:self.skippedCount
|
||||
];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -120,11 +116,11 @@
|
|||
self.completionBlock = completionBlock;
|
||||
self.progressBlock = progressBlock;
|
||||
|
||||
if(urls.count == 0){
|
||||
if(completionBlock){
|
||||
if (urls.count == 0) {
|
||||
if (completionBlock) {
|
||||
completionBlock(0,0);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
// Starts prefetching from the very first image on the list with the max allowed concurrency
|
||||
NSUInteger listCount = self.prefetchURLs.count;
|
||||
for (NSUInteger i = 0; i < self.maxConcurrentDownloads && self.requestedCount < listCount; i++) {
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@
|
|||
* @param completedBlock A block called when operation has been completed. This block has no return value
|
||||
* and takes the requested UIImage as first parameter. In case of error the image parameter
|
||||
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
|
||||
* indicating if the image was retrived from the local cache or from the network.
|
||||
* indicating if the image was retrieved from the local cache or from the network.
|
||||
* The fourth parameter is the original image url.
|
||||
*/
|
||||
- (void)sd_setImageWithURL:(NSURL *)url forState:(UIControlState)state completed:(SDWebImageCompletionBlock)completedBlock;
|
||||
|
|
@ -86,7 +86,7 @@
|
|||
* @param completedBlock A block called when operation has been completed. This block has no return value
|
||||
* and takes the requested UIImage as first parameter. In case of error the image parameter
|
||||
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
|
||||
* indicating if the image was retrived from the local cache or from the network.
|
||||
* indicating if the image was retrieved from the local cache or from the network.
|
||||
* The fourth parameter is the original image url.
|
||||
*/
|
||||
- (void)sd_setImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletionBlock)completedBlock;
|
||||
|
|
@ -103,7 +103,7 @@
|
|||
* @param completedBlock A block called when operation has been completed. This block has no return value
|
||||
* and takes the requested UIImage as first parameter. In case of error the image parameter
|
||||
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
|
||||
* indicating if the image was retrived from the local cache or from the network.
|
||||
* indicating if the image was retrieved from the local cache or from the network.
|
||||
* The fourth parameter is the original image url.
|
||||
*/
|
||||
- (void)sd_setImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletionBlock)completedBlock;
|
||||
|
|
@ -152,7 +152,7 @@
|
|||
* @param completedBlock A block called when operation has been completed. This block has no return value
|
||||
* and takes the requested UIImage as first parameter. In case of error the image parameter
|
||||
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
|
||||
* indicating if the image was retrived from the local cache or from the network.
|
||||
* indicating if the image was retrieved from the local cache or from the network.
|
||||
* The fourth parameter is the original image url.
|
||||
*/
|
||||
- (void)sd_setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state completed:(SDWebImageCompletionBlock)completedBlock;
|
||||
|
|
@ -168,7 +168,7 @@
|
|||
* @param completedBlock A block called when operation has been completed. This block has no return value
|
||||
* and takes the requested UIImage as first parameter. In case of error the image parameter
|
||||
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
|
||||
* indicating if the image was retrived from the local cache or from the network.
|
||||
* indicating if the image was retrieved from the local cache or from the network.
|
||||
* The fourth parameter is the original image url.
|
||||
*/
|
||||
- (void)sd_setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletionBlock)completedBlock;
|
||||
|
|
@ -184,7 +184,7 @@
|
|||
* @param completedBlock A block called when operation has been completed. This block has no return value
|
||||
* and takes the requested UIImage as first parameter. In case of error the image parameter
|
||||
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
|
||||
* indicating if the image was retrived from the local cache or from the network.
|
||||
* indicating if the image was retrieved from the local cache or from the network.
|
||||
* The fourth parameter is the original image url.
|
||||
*/
|
||||
- (void)sd_setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletionBlock)completedBlock;
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ static char imageURLStorageKey;
|
|||
[self.imageURLStorage removeObjectForKey:@(state)];
|
||||
|
||||
dispatch_main_async_safe(^{
|
||||
NSError *error = [NSError errorWithDomain:@"SDWebImageErrorDomain" code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}];
|
||||
if (completedBlock) {
|
||||
NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}];
|
||||
completedBlock(nil, error, SDImageCacheTypeNone, url);
|
||||
}
|
||||
});
|
||||
|
|
@ -68,13 +68,18 @@ static char imageURLStorageKey;
|
|||
|
||||
self.imageURLStorage[@(state)] = url;
|
||||
|
||||
__weak UIButton *wself = self;
|
||||
__weak __typeof(self)wself = self;
|
||||
id <SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadImageWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
|
||||
if (!wself) return;
|
||||
dispatch_main_sync_safe(^{
|
||||
__strong UIButton *sself = wself;
|
||||
if (!sself) return;
|
||||
if (image) {
|
||||
if (image && (options & SDWebImageAvoidAutoSetImage) && completedBlock)
|
||||
{
|
||||
completedBlock(image, error, cacheType, url);
|
||||
return;
|
||||
}
|
||||
else if (image) {
|
||||
[sself setImage:image forState:state];
|
||||
}
|
||||
if (completedBlock && finished) {
|
||||
|
|
@ -106,18 +111,23 @@ static char imageURLStorageKey;
|
|||
}
|
||||
|
||||
- (void)sd_setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletionBlock)completedBlock {
|
||||
[self sd_cancelImageLoadForState:state];
|
||||
[self sd_cancelBackgroundImageLoadForState:state];
|
||||
|
||||
[self setBackgroundImage:placeholder forState:state];
|
||||
|
||||
if (url) {
|
||||
__weak UIButton *wself = self;
|
||||
__weak __typeof(self)wself = self;
|
||||
id <SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadImageWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
|
||||
if (!wself) return;
|
||||
dispatch_main_sync_safe(^{
|
||||
__strong UIButton *sself = wself;
|
||||
if (!sself) return;
|
||||
if (image) {
|
||||
if (image && (options & SDWebImageAvoidAutoSetImage) && completedBlock)
|
||||
{
|
||||
completedBlock(image, error, cacheType, url);
|
||||
return;
|
||||
}
|
||||
else if (image) {
|
||||
[sself setBackgroundImage:image forState:state];
|
||||
}
|
||||
if (completedBlock && finished) {
|
||||
|
|
@ -128,7 +138,7 @@ static char imageURLStorageKey;
|
|||
[self sd_setBackgroundImageLoadOperation:operation forState:state];
|
||||
} else {
|
||||
dispatch_main_async_safe(^{
|
||||
NSError *error = [NSError errorWithDomain:@"SDWebImageErrorDomain" code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}];
|
||||
NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}];
|
||||
if (completedBlock) {
|
||||
completedBlock(nil, error, SDImageCacheTypeNone, url);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@
|
|||
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
CGImageRef image = CGImageSourceCreateImageAtIndex(source, i, NULL);
|
||||
if (!image) {
|
||||
continue;
|
||||
}
|
||||
|
||||
duration += [self sd_frameDurationAtIndex:i source:source];
|
||||
|
||||
|
|
@ -141,17 +144,17 @@
|
|||
|
||||
NSMutableArray *scaledImages = [NSMutableArray array];
|
||||
|
||||
UIGraphicsBeginImageContextWithOptions(size, NO, 0.0);
|
||||
|
||||
for (UIImage *image in self.images) {
|
||||
UIGraphicsBeginImageContextWithOptions(size, NO, 0.0);
|
||||
|
||||
[image drawInRect:CGRectMake(thumbnailPoint.x, thumbnailPoint.y, scaledSize.width, scaledSize.height)];
|
||||
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
|
||||
|
||||
[scaledImages addObject:newImage];
|
||||
|
||||
UIGraphicsEndImageContext();
|
||||
}
|
||||
|
||||
UIGraphicsEndImageContext();
|
||||
|
||||
|
||||
return [UIImage animatedImageWithImages:scaledImages duration:self.duration];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,10 @@
|
|||
@implementation UIImage (MultiFormat)
|
||||
|
||||
+ (UIImage *)sd_imageWithData:(NSData *)data {
|
||||
if (!data) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
UIImage *image;
|
||||
NSString *imageContentType = [NSData sd_contentTypeForImageData:data];
|
||||
if ([imageContentType isEqualToString:@"image/gif"]) {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,12 @@
|
|||
|
||||
#ifdef SD_WEBP
|
||||
#import "UIImage+WebP.h"
|
||||
|
||||
#if !COCOAPODS
|
||||
#import "webp/decode.h"
|
||||
#else
|
||||
#import "webp/decode.h"
|
||||
#endif
|
||||
|
||||
// Callback for CGDataProviderRelease
|
||||
static void FreeImageData(void *info, const void *data, size_t size)
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
* @param completedBlock A block called when operation has been completed. This block has no return value
|
||||
* and takes the requested UIImage as first parameter. In case of error the image parameter
|
||||
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
|
||||
* indicating if the image was retrived from the local cache or from the network.
|
||||
* indicating if the image was retrieved from the local cache or from the network.
|
||||
* The fourth parameter is the original image url.
|
||||
*/
|
||||
- (void)sd_setHighlightedImageWithURL:(NSURL *)url completed:(SDWebImageCompletionBlock)completedBlock;
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
* @param completedBlock A block called when operation has been completed. This block has no return value
|
||||
* and takes the requested UIImage as first parameter. In case of error the image parameter
|
||||
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
|
||||
* indicating if the image was retrived from the local cache or from the network.
|
||||
* indicating if the image was retrieved from the local cache or from the network.
|
||||
* The fourth parameter is the original image url.
|
||||
*/
|
||||
- (void)sd_setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options completed:(SDWebImageCompletionBlock)completedBlock;
|
||||
|
|
@ -74,7 +74,7 @@
|
|||
* @param completedBlock A block called when operation has been completed. This block has no return value
|
||||
* and takes the requested UIImage as first parameter. In case of error the image parameter
|
||||
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
|
||||
* indicating if the image was retrived from the local cache or from the network.
|
||||
* indicating if the image was retrieved from the local cache or from the network.
|
||||
* The fourth parameter is the original image url.
|
||||
*/
|
||||
- (void)sd_setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock;
|
||||
|
|
|
|||
|
|
@ -33,13 +33,18 @@
|
|||
[self sd_cancelCurrentHighlightedImageLoad];
|
||||
|
||||
if (url) {
|
||||
__weak UIImageView *wself = self;
|
||||
__weak __typeof(self)wself = self;
|
||||
id<SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadImageWithURL:url options:options progress:progressBlock completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
|
||||
if (!wself) return;
|
||||
dispatch_main_sync_safe (^
|
||||
{
|
||||
if (!wself) return;
|
||||
if (image) {
|
||||
if (image && (options & SDWebImageAvoidAutoSetImage) && completedBlock)
|
||||
{
|
||||
completedBlock(image, error, cacheType, url);
|
||||
return;
|
||||
}
|
||||
else if (image) {
|
||||
wself.highlightedImage = image;
|
||||
[wself setNeedsLayout];
|
||||
}
|
||||
|
|
@ -51,7 +56,7 @@
|
|||
[self sd_setImageLoadOperation:operation forKey:UIImageViewHighlightedWebCacheOperationKey];
|
||||
} else {
|
||||
dispatch_main_async_safe(^{
|
||||
NSError *error = [NSError errorWithDomain:@"SDWebImageErrorDomain" code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}];
|
||||
NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}];
|
||||
if (completedBlock) {
|
||||
completedBlock(nil, error, SDImageCacheTypeNone, url);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@
|
|||
* @param completedBlock A block called when operation has been completed. This block has no return value
|
||||
* and takes the requested UIImage as first parameter. In case of error the image parameter
|
||||
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
|
||||
* indicating if the image was retrived from the local cache or from the network.
|
||||
* indicating if the image was retrieved from the local cache or from the network.
|
||||
* The fourth parameter is the original image url.
|
||||
*/
|
||||
- (void)sd_setImageWithURL:(NSURL *)url completed:(SDWebImageCompletionBlock)completedBlock;
|
||||
|
|
@ -107,7 +107,7 @@
|
|||
* @param completedBlock A block called when operation has been completed. This block has no return value
|
||||
* and takes the requested UIImage as first parameter. In case of error the image parameter
|
||||
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
|
||||
* indicating if the image was retrived from the local cache or from the network.
|
||||
* indicating if the image was retrieved from the local cache or from the network.
|
||||
* The fourth parameter is the original image url.
|
||||
*/
|
||||
- (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletionBlock)completedBlock;
|
||||
|
|
@ -123,7 +123,7 @@
|
|||
* @param completedBlock A block called when operation has been completed. This block has no return value
|
||||
* and takes the requested UIImage as first parameter. In case of error the image parameter
|
||||
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
|
||||
* indicating if the image was retrived from the local cache or from the network.
|
||||
* indicating if the image was retrieved from the local cache or from the network.
|
||||
* The fourth parameter is the original image url.
|
||||
*/
|
||||
- (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletionBlock)completedBlock;
|
||||
|
|
@ -140,13 +140,13 @@
|
|||
* @param completedBlock A block called when operation has been completed. This block has no return value
|
||||
* and takes the requested UIImage as first parameter. In case of error the image parameter
|
||||
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
|
||||
* indicating if the image was retrived from the local cache or from the network.
|
||||
* indicating if the image was retrieved from the local cache or from the network.
|
||||
* The fourth parameter is the original image url.
|
||||
*/
|
||||
- (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock;
|
||||
|
||||
/**
|
||||
* Set the imageView `image` with an `url` and a optionaly placeholder image.
|
||||
* Set the imageView `image` with an `url` and optionally a placeholder image.
|
||||
*
|
||||
* The download is asynchronous and cached.
|
||||
*
|
||||
|
|
@ -157,10 +157,10 @@
|
|||
* @param completedBlock A block called when operation has been completed. This block has no return value
|
||||
* and takes the requested UIImage as first parameter. In case of error the image parameter
|
||||
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
|
||||
* indicating if the image was retrived from the local cache or from the network.
|
||||
* indicating if the image was retrieved from the local cache or from the network.
|
||||
* The fourth parameter is the original image url.
|
||||
*/
|
||||
- (void)sd_setImageWithPreviousCachedImageWithURL:(NSURL *)url andPlaceholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock;
|
||||
- (void)sd_setImageWithPreviousCachedImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock;
|
||||
|
||||
/**
|
||||
* Download an array of images and starts them in an animation loop
|
||||
|
|
@ -176,6 +176,18 @@
|
|||
|
||||
- (void)sd_cancelCurrentAnimationImagesLoad;
|
||||
|
||||
/**
|
||||
* Show activity UIActivityIndicatorView
|
||||
*/
|
||||
- (void)setShowActivityIndicatorView:(BOOL)show;
|
||||
|
||||
/**
|
||||
* set desired UIActivityIndicatorViewStyle
|
||||
*
|
||||
* @param style The style of the UIActivityIndicatorView
|
||||
*/
|
||||
- (void)setIndicatorStyle:(UIActivityIndicatorViewStyle)style;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
|
@ -192,6 +204,8 @@
|
|||
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:placeholderImage:options:completed:`");
|
||||
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:placeholderImage:options:progress:completed:`");
|
||||
|
||||
- (void)sd_setImageWithPreviousCachedImageWithURL:(NSURL *)url andPlaceholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setImageWithPreviousCachedImageWithURL:placeholderImage:options:progress:completed:`");
|
||||
|
||||
- (void)setAnimationImagesWithURLs:(NSArray *)arrayOfURLs __deprecated_msg("Use `sd_setAnimationImagesWithURLs:`");
|
||||
|
||||
- (void)cancelCurrentArrayLoad __deprecated_msg("Use `sd_cancelCurrentAnimationImagesLoad`");
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@
|
|||
#import "UIView+WebCacheOperation.h"
|
||||
|
||||
static char imageURLKey;
|
||||
static char TAG_ACTIVITY_INDICATOR;
|
||||
static char TAG_ACTIVITY_STYLE;
|
||||
static char TAG_ACTIVITY_SHOW;
|
||||
|
||||
@implementation UIImageView (WebCache)
|
||||
|
||||
|
|
@ -49,12 +52,24 @@ static char imageURLKey;
|
|||
}
|
||||
|
||||
if (url) {
|
||||
__weak UIImageView *wself = self;
|
||||
|
||||
// check if activityView is enabled or not
|
||||
if ([self showActivityIndicatorView]) {
|
||||
[self addActivityIndicator];
|
||||
}
|
||||
|
||||
__weak __typeof(self)wself = self;
|
||||
id <SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadImageWithURL:url options:options progress:progressBlock completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
|
||||
[wself removeActivityIndicator];
|
||||
if (!wself) return;
|
||||
dispatch_main_sync_safe(^{
|
||||
if (!wself) return;
|
||||
if (image) {
|
||||
if (image && (options & SDWebImageAvoidAutoSetImage) && completedBlock)
|
||||
{
|
||||
completedBlock(image, error, cacheType, url);
|
||||
return;
|
||||
}
|
||||
else if (image) {
|
||||
wself.image = image;
|
||||
[wself setNeedsLayout];
|
||||
} else {
|
||||
|
|
@ -71,15 +86,16 @@ static char imageURLKey;
|
|||
[self sd_setImageLoadOperation:operation forKey:@"UIImageViewImageLoad"];
|
||||
} else {
|
||||
dispatch_main_async_safe(^{
|
||||
NSError *error = [NSError errorWithDomain:@"SDWebImageErrorDomain" code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}];
|
||||
[self removeActivityIndicator];
|
||||
if (completedBlock) {
|
||||
NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}];
|
||||
completedBlock(nil, error, SDImageCacheTypeNone, url);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
- (void)sd_setImageWithPreviousCachedImageWithURL:(NSURL *)url andPlaceholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock {
|
||||
- (void)sd_setImageWithPreviousCachedImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock {
|
||||
NSString *key = [[SDWebImageManager sharedManager] cacheKeyForURL:url];
|
||||
UIImage *lastPreviousCachedImage = [[SDImageCache sharedImageCache] imageFromDiskCacheForKey:key];
|
||||
|
||||
|
|
@ -92,7 +108,7 @@ static char imageURLKey;
|
|||
|
||||
- (void)sd_setAnimationImagesWithURLs:(NSArray *)arrayOfURLs {
|
||||
[self sd_cancelCurrentAnimationImagesLoad];
|
||||
__weak UIImageView *wself = self;
|
||||
__weak __typeof(self)wself = self;
|
||||
|
||||
NSMutableArray *operationsArray = [[NSMutableArray alloc] init];
|
||||
|
||||
|
|
@ -129,6 +145,70 @@ static char imageURLKey;
|
|||
[self sd_cancelImageLoadOperationWithKey:@"UIImageViewAnimationImages"];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
- (UIActivityIndicatorView *)activityIndicator {
|
||||
return (UIActivityIndicatorView *)objc_getAssociatedObject(self, &TAG_ACTIVITY_INDICATOR);
|
||||
}
|
||||
|
||||
- (void)setActivityIndicator:(UIActivityIndicatorView *)activityIndicator {
|
||||
objc_setAssociatedObject(self, &TAG_ACTIVITY_INDICATOR, activityIndicator, OBJC_ASSOCIATION_RETAIN);
|
||||
}
|
||||
|
||||
- (void)setShowActivityIndicatorView:(BOOL)show{
|
||||
objc_setAssociatedObject(self, &TAG_ACTIVITY_SHOW, [NSNumber numberWithBool:show], OBJC_ASSOCIATION_RETAIN);
|
||||
}
|
||||
|
||||
- (BOOL)showActivityIndicatorView{
|
||||
return [objc_getAssociatedObject(self, &TAG_ACTIVITY_SHOW) boolValue];
|
||||
}
|
||||
|
||||
- (void)setIndicatorStyle:(UIActivityIndicatorViewStyle)style{
|
||||
objc_setAssociatedObject(self, &TAG_ACTIVITY_STYLE, [NSNumber numberWithInt:style], OBJC_ASSOCIATION_RETAIN);
|
||||
}
|
||||
|
||||
- (int)getIndicatorStyle{
|
||||
return [objc_getAssociatedObject(self, &TAG_ACTIVITY_STYLE) intValue];
|
||||
}
|
||||
|
||||
- (void)addActivityIndicator {
|
||||
if (!self.activityIndicator) {
|
||||
self.activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:[self getIndicatorStyle]];
|
||||
self.activityIndicator.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
|
||||
dispatch_main_async_safe(^{
|
||||
[self addSubview:self.activityIndicator];
|
||||
|
||||
[self addConstraint:[NSLayoutConstraint constraintWithItem:self.activityIndicator
|
||||
attribute:NSLayoutAttributeCenterX
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self
|
||||
attribute:NSLayoutAttributeCenterX
|
||||
multiplier:1.0
|
||||
constant:0.0]];
|
||||
[self addConstraint:[NSLayoutConstraint constraintWithItem:self.activityIndicator
|
||||
attribute:NSLayoutAttributeCenterY
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self
|
||||
attribute:NSLayoutAttributeCenterY
|
||||
multiplier:1.0
|
||||
constant:0.0]];
|
||||
});
|
||||
}
|
||||
|
||||
dispatch_main_async_safe(^{
|
||||
[self.activityIndicator startAnimating];
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
- (void)removeActivityIndicator {
|
||||
if (self.activityIndicator) {
|
||||
[self.activityIndicator removeFromSuperview];
|
||||
self.activityIndicator = nil;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
|
@ -182,6 +262,10 @@ static char imageURLKey;
|
|||
}];
|
||||
}
|
||||
|
||||
- (void)sd_setImageWithPreviousCachedImageWithURL:(NSURL *)url andPlaceholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock {
|
||||
[self sd_setImageWithPreviousCachedImageWithURL:url placeholderImage:placeholder options:options progress:progressBlock completed:completedBlock];
|
||||
}
|
||||
|
||||
- (void)cancelCurrentArrayLoad {
|
||||
[self sd_cancelCurrentAnimationImagesLoad];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,13 +3,9 @@ source 'https://github.com/CocoaPods/Specs.git'
|
|||
xcodeproj 'SDWebImage Tests'
|
||||
workspace '../SDWebImage'
|
||||
|
||||
def import_pods
|
||||
pod 'Expecta', '<=0.3.1' # A Matcher Framework for Objective-C/Cocoa
|
||||
target 'Tests' do
|
||||
platform :ios, '7.0'
|
||||
pod 'Expecta', '<=0.3.1'
|
||||
pod 'SDWebImage', :path => '../'
|
||||
end
|
||||
|
||||
target :ios do
|
||||
platform :ios, '5.0'
|
||||
link_with 'Tests'
|
||||
import_pods
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@
|
|||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
ABC8501F672447AA91C788DA /* libPods-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EB0D107E6B4C4094BA2FEE29 /* libPods-ios.a */; };
|
||||
2278D185E97AF851CF3F9A07 /* libPods-Tests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F0EF05B6C461610578D6C2A6 /* libPods-Tests.a */; };
|
||||
5F7F38AD1AE2A77A00B0E330 /* TestImage.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 5F7F38AC1AE2A77A00B0E330 /* TestImage.jpg */; };
|
||||
DA248D57195472AA00390AB0 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA248D56195472AA00390AB0 /* XCTest.framework */; };
|
||||
DA248D59195472AA00390AB0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA248D58195472AA00390AB0 /* Foundation.framework */; };
|
||||
DA248D5B195472AA00390AB0 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA248D5A195472AA00390AB0 /* UIKit.framework */; };
|
||||
|
|
@ -18,8 +19,9 @@
|
|||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
1A6DF883515E8008203AB352 /* Pods-ios.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ios.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ios/Pods-ios.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
CA88E6BDE3581B2BFE933C10 /* Pods-ios.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ios.release.xcconfig"; path = "Pods/Target Support Files/Pods-ios/Pods-ios.release.xcconfig"; sourceTree = "<group>"; };
|
||||
0EAE9F732E05E3878DC9D2D1 /* Pods-Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Tests/Pods-Tests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
2FAA0419497C5AA7F0EA0E20 /* Pods-Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-Tests/Pods-Tests.release.xcconfig"; sourceTree = "<group>"; };
|
||||
5F7F38AC1AE2A77A00B0E330 /* TestImage.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = TestImage.jpg; sourceTree = "<group>"; };
|
||||
DA248D53195472AA00390AB0 /* Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
DA248D56195472AA00390AB0 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
|
||||
DA248D58195472AA00390AB0 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
|
||||
|
|
@ -30,7 +32,7 @@
|
|||
DA248D68195475D800390AB0 /* SDImageCacheTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDImageCacheTests.m; sourceTree = "<group>"; };
|
||||
DA248D6A195476AC00390AB0 /* SDWebImageManagerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDWebImageManagerTests.m; sourceTree = "<group>"; };
|
||||
DA91BEBB19795BC9006F2536 /* UIImageMultiFormatTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIImageMultiFormatTests.m; sourceTree = "<group>"; };
|
||||
EB0D107E6B4C4094BA2FEE29 /* libPods-ios.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ios.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
F0EF05B6C461610578D6C2A6 /* libPods-Tests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Tests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
|
@ -41,7 +43,7 @@
|
|||
DA248D57195472AA00390AB0 /* XCTest.framework in Frameworks */,
|
||||
DA248D5B195472AA00390AB0 /* UIKit.framework in Frameworks */,
|
||||
DA248D59195472AA00390AB0 /* Foundation.framework in Frameworks */,
|
||||
ABC8501F672447AA91C788DA /* libPods-ios.a in Frameworks */,
|
||||
2278D185E97AF851CF3F9A07 /* libPods-Tests.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
@ -51,8 +53,8 @@
|
|||
8D1A343B1A6D91E95D7795EF /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1A6DF883515E8008203AB352 /* Pods-ios.debug.xcconfig */,
|
||||
CA88E6BDE3581B2BFE933C10 /* Pods-ios.release.xcconfig */,
|
||||
0EAE9F732E05E3878DC9D2D1 /* Pods-Tests.debug.xcconfig */,
|
||||
2FAA0419497C5AA7F0EA0E20 /* Pods-Tests.release.xcconfig */,
|
||||
);
|
||||
name = Pods;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -81,7 +83,7 @@
|
|||
DA248D56195472AA00390AB0 /* XCTest.framework */,
|
||||
DA248D58195472AA00390AB0 /* Foundation.framework */,
|
||||
DA248D5A195472AA00390AB0 /* UIKit.framework */,
|
||||
EB0D107E6B4C4094BA2FEE29 /* libPods-ios.a */,
|
||||
F0EF05B6C461610578D6C2A6 /* libPods-Tests.a */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -89,6 +91,7 @@
|
|||
DA248D5C195472AA00390AB0 /* Tests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
5F7F38AC1AE2A77A00B0E330 /* TestImage.jpg */,
|
||||
DA248D5D195472AA00390AB0 /* Supporting Files */,
|
||||
DA248D68195475D800390AB0 /* SDImageCacheTests.m */,
|
||||
DA248D6A195476AC00390AB0 /* SDWebImageManagerTests.m */,
|
||||
|
|
@ -114,11 +117,12 @@
|
|||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = DA248D67195472AA00390AB0 /* Build configuration list for PBXNativeTarget "Tests" */;
|
||||
buildPhases = (
|
||||
FBC8982311CD4ED9A3006D45 /* Check Pods Manifest.lock */,
|
||||
FBC8982311CD4ED9A3006D45 /* 📦 Check Pods Manifest.lock */,
|
||||
DA248D4F195472AA00390AB0 /* Sources */,
|
||||
DA248D50195472AA00390AB0 /* Frameworks */,
|
||||
DA248D51195472AA00390AB0 /* Resources */,
|
||||
D6347736BDF64FC5A4D078A4 /* Copy Pods Resources */,
|
||||
D6347736BDF64FC5A4D078A4 /* 📦 Copy Pods Resources */,
|
||||
4B51E412BA3594400947AC71 /* 📦 Embed Pods Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
|
|
@ -159,6 +163,7 @@
|
|||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
5F7F38AD1AE2A77A00B0E330 /* TestImage.jpg in Resources */,
|
||||
DA248D61195472AA00390AB0 /* InfoPlist.strings in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
|
@ -166,29 +171,44 @@
|
|||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
D6347736BDF64FC5A4D078A4 /* Copy Pods Resources */ = {
|
||||
4B51E412BA3594400947AC71 /* 📦 Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Copy Pods Resources";
|
||||
name = "📦 Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ios/Pods-ios-resources.sh\"\n";
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Tests/Pods-Tests-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
FBC8982311CD4ED9A3006D45 /* Check Pods Manifest.lock */ = {
|
||||
D6347736BDF64FC5A4D078A4 /* 📦 Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Check Pods Manifest.lock";
|
||||
name = "📦 Copy Pods Resources";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Tests/Pods-Tests-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
FBC8982311CD4ED9A3006D45 /* 📦 Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "📦 Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
|
@ -237,7 +257,7 @@
|
|||
};
|
||||
DA248D65195472AA00390AB0 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 1A6DF883515E8008203AB352 /* Pods-ios.debug.xcconfig */;
|
||||
baseConfigurationReference = 0EAE9F732E05E3878DC9D2D1 /* Pods-Tests.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
|
|
@ -254,7 +274,6 @@
|
|||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(SDKROOT)/Developer/Library/Frameworks",
|
||||
"$(inherited)",
|
||||
"$(DEVELOPER_FRAMEWORKS_DIR)",
|
||||
);
|
||||
|
|
@ -285,7 +304,7 @@
|
|||
};
|
||||
DA248D66195472AA00390AB0 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = CA88E6BDE3581B2BFE933C10 /* Pods-ios.release.xcconfig */;
|
||||
baseConfigurationReference = 2FAA0419497C5AA7F0EA0E20 /* Pods-Tests.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
|
|
@ -303,7 +322,6 @@
|
|||
COPY_PHASE_STRIP = YES;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(SDKROOT)/Developer/Library/Frameworks",
|
||||
"$(inherited)",
|
||||
"$(DEVELOPER_FRAMEWORKS_DIR)",
|
||||
);
|
||||
|
|
|
|||
|
|
@ -14,9 +14,10 @@
|
|||
|
||||
#import "SDImageCache.h"
|
||||
|
||||
NSString *kImageTestKey = @"TestImageKey.jpg";
|
||||
|
||||
@interface SDImageCacheTests : XCTestCase
|
||||
|
||||
@property (strong, nonatomic) SDImageCache *sharedImageCache;
|
||||
@end
|
||||
|
||||
@implementation SDImageCacheTests
|
||||
|
|
@ -25,6 +26,8 @@
|
|||
{
|
||||
[super setUp];
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
self.sharedImageCache = [SDImageCache sharedImageCache];
|
||||
[self clearAllCaches];
|
||||
}
|
||||
|
||||
- (void)tearDown
|
||||
|
|
@ -34,9 +37,189 @@
|
|||
}
|
||||
|
||||
- (void)testSharedImageCache {
|
||||
SDImageCache *sharedImageCache = [SDImageCache sharedImageCache];
|
||||
expect(self.sharedImageCache).toNot.beNil();
|
||||
}
|
||||
|
||||
- (void)testSingleton{
|
||||
expect(self.sharedImageCache).to.equal([SDImageCache sharedImageCache]);
|
||||
}
|
||||
|
||||
- (void)testClearDiskCache{
|
||||
[self.sharedImageCache storeImage:[self imageForTesting] forKey:kImageTestKey];
|
||||
[self.sharedImageCache clearDiskOnCompletion:^{
|
||||
expect([self.sharedImageCache diskImageExistsWithKey:kImageTestKey]).to.equal(NO);
|
||||
expect([self.sharedImageCache imageFromMemoryCacheForKey:kImageTestKey]).to.equal([self imageForTesting]);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testClearMemoryCache{
|
||||
[self.sharedImageCache storeImage:[self imageForTesting] forKey:kImageTestKey];
|
||||
[self.sharedImageCache clearMemory];
|
||||
expect([self.sharedImageCache imageFromMemoryCacheForKey:kImageTestKey]).to.beNil;
|
||||
// Seems not able to access the files correctly (maybe only from test?)
|
||||
//expect([self.sharedImageCache diskImageExistsWithKey:kImageTestKey]).to.equal(YES);
|
||||
[self.sharedImageCache diskImageExistsWithKey:kImageTestKey completion:^(BOOL isInCache) {
|
||||
expect(isInCache).to.equal(YES);
|
||||
}];
|
||||
}
|
||||
|
||||
// Testing storeImage:forKey:
|
||||
- (void)testInsertionOfImage {
|
||||
UIImage *image = [self imageForTesting];
|
||||
[self.sharedImageCache storeImage:image forKey:kImageTestKey];
|
||||
expect([self.sharedImageCache imageFromMemoryCacheForKey:kImageTestKey]).to.equal(image);
|
||||
expect([self.sharedImageCache imageFromDiskCacheForKey:kImageTestKey]).to.equal(image);
|
||||
}
|
||||
|
||||
// Testing storeImage:forKey:toDisk:YES
|
||||
- (void)testInsertionOfImageForcingDiskStorage{
|
||||
UIImage *image = [self imageForTesting];
|
||||
[self.sharedImageCache storeImage:image forKey:kImageTestKey toDisk:YES];
|
||||
expect([self.sharedImageCache imageFromMemoryCacheForKey:kImageTestKey]).to.equal(image);
|
||||
// Seems not able to access the files correctly (maybe only from test?)
|
||||
//expect([self.sharedImageCache diskImageExistsWithKey:kImageTestKey]).to.equal(YES);
|
||||
[self.sharedImageCache diskImageExistsWithKey:kImageTestKey completion:^(BOOL isInCache) {
|
||||
expect(isInCache).to.equal(YES);
|
||||
}];
|
||||
}
|
||||
|
||||
// Testing storeImage:forKey:toDisk:NO
|
||||
- (void)testInsertionOfImageOnlyInMemory {
|
||||
UIImage *image = [self imageForTesting];
|
||||
[self.sharedImageCache storeImage:image forKey:@"TestImage" toDisk:NO];
|
||||
[self.sharedImageCache diskImageExistsWithKey:@"TestImage" completion:^(BOOL isInCache) {
|
||||
expect(isInCache).to.equal(YES);
|
||||
}];
|
||||
[self.sharedImageCache clearMemory];
|
||||
[self.sharedImageCache diskImageExistsWithKey:@"TestImage" completion:^(BOOL isInCache) {
|
||||
expect(isInCache).to.equal(NO);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testRetrievalImageThroughNSOperation{
|
||||
//- (NSOperation *)queryDiskCacheForKey:(NSString *)key done:(SDWebImageQueryCompletedBlock)doneBlock;
|
||||
UIImage *imageForTesting = [self imageForTesting];
|
||||
[self.sharedImageCache storeImage:imageForTesting forKey:kImageTestKey];
|
||||
NSOperation *operation = [self.sharedImageCache queryDiskCacheForKey:kImageTestKey done:^(UIImage *image, SDImageCacheType cacheType) {
|
||||
expect(image).to.equal(imageForTesting);
|
||||
}];
|
||||
expect(operation).toNot.beNil;
|
||||
}
|
||||
|
||||
- (void)testRemoveImageForKey{
|
||||
[self.sharedImageCache storeImage:[self imageForTesting] forKey:kImageTestKey];
|
||||
[self.sharedImageCache removeImageForKey:kImageTestKey];
|
||||
expect([self.sharedImageCache imageFromMemoryCacheForKey:kImageTestKey]).to.beNil;
|
||||
expect([self.sharedImageCache imageFromDiskCacheForKey:kImageTestKey]).to.beNil;
|
||||
}
|
||||
|
||||
- (void)testRemoveImageForKeyWithCompletion{
|
||||
[self.sharedImageCache storeImage:[self imageForTesting] forKey:kImageTestKey];
|
||||
[self.sharedImageCache removeImageForKey:kImageTestKey withCompletion:^{
|
||||
expect([self.sharedImageCache imageFromDiskCacheForKey:kImageTestKey]).to.beNil;
|
||||
expect([self.sharedImageCache imageFromMemoryCacheForKey:kImageTestKey]).to.beNil;
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testRemoveImageForKeyNotFromDisk{
|
||||
[self.sharedImageCache storeImage:[self imageForTesting] forKey:kImageTestKey];
|
||||
[self.sharedImageCache removeImageForKey:kImageTestKey fromDisk:NO];
|
||||
expect([self.sharedImageCache imageFromDiskCacheForKey:kImageTestKey]).toNot.beNil;
|
||||
expect([self.sharedImageCache imageFromMemoryCacheForKey:kImageTestKey]).to.beNil;
|
||||
}
|
||||
|
||||
- (void)testRemoveImageForKeyFromDisk{
|
||||
[self.sharedImageCache storeImage:[self imageForTesting] forKey:kImageTestKey];
|
||||
[self.sharedImageCache removeImageForKey:kImageTestKey fromDisk:NO];
|
||||
expect([self.sharedImageCache imageFromDiskCacheForKey:kImageTestKey]).to.beNil;
|
||||
expect([self.sharedImageCache imageFromMemoryCacheForKey:kImageTestKey]).to.beNil;
|
||||
}
|
||||
|
||||
- (void)testRemoveImageforKeyNotFromDiskWithCompletion{
|
||||
[self.sharedImageCache storeImage:[self imageForTesting] forKey:kImageTestKey];
|
||||
[self.sharedImageCache removeImageForKey:kImageTestKey fromDisk:NO withCompletion:^{
|
||||
expect([self.sharedImageCache imageFromDiskCacheForKey:kImageTestKey]).toNot.beNil;
|
||||
expect([self.sharedImageCache imageFromMemoryCacheForKey:kImageTestKey]).to.beNil;
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testRemoveImageforKeyFromDiskWithCompletion{
|
||||
[self.sharedImageCache storeImage:[self imageForTesting] forKey:kImageTestKey];
|
||||
[self.sharedImageCache removeImageForKey:kImageTestKey fromDisk:YES withCompletion:^{
|
||||
expect([self.sharedImageCache imageFromDiskCacheForKey:kImageTestKey]).to.beNil;
|
||||
expect([self.sharedImageCache imageFromMemoryCacheForKey:kImageTestKey]).to.beNil;
|
||||
}];
|
||||
}
|
||||
|
||||
// TODO -- Testing insertion with recalculate
|
||||
- (void)testInsertionOfImageOnlyInDisk {
|
||||
}
|
||||
|
||||
- (void)testInitialCacheSize{
|
||||
expect([self.sharedImageCache getSize]).to.equal(0);
|
||||
}
|
||||
|
||||
- (void)testInitialDiskCount{
|
||||
[self.sharedImageCache storeImage:[self imageForTesting] forKey:kImageTestKey];
|
||||
expect([self.sharedImageCache getDiskCount]).to.equal(1);
|
||||
}
|
||||
|
||||
- (void)testDiskCountAfterInsertion{
|
||||
[self.sharedImageCache storeImage:[self imageForTesting] forKey:kImageTestKey];
|
||||
expect([self.sharedImageCache getDiskCount]).to.equal(1);
|
||||
}
|
||||
|
||||
- (void)testDefaultCachePathForAnyKey{
|
||||
NSString *path = [self.sharedImageCache defaultCachePathForKey:kImageTestKey];
|
||||
expect(path).toNot.beNil;
|
||||
}
|
||||
|
||||
- (void)testCachePathForNonExistingKey{
|
||||
NSString *path = [self.sharedImageCache cachePathForKey:kImageTestKey inPath:[self.sharedImageCache defaultCachePathForKey:kImageTestKey]];
|
||||
expect(path).to.beNil;
|
||||
}
|
||||
|
||||
- (void)testCachePathForExistingKey{
|
||||
[self.sharedImageCache storeImage:[self imageForTesting] forKey:kImageTestKey];
|
||||
NSString *path = [self.sharedImageCache cachePathForKey:kImageTestKey inPath:[self.sharedImageCache defaultCachePathForKey:kImageTestKey]];
|
||||
expect(path).notTo.beNil;
|
||||
}
|
||||
|
||||
// TODO -- Testing image data insertion
|
||||
|
||||
- (void)testInsertionOfImageData {
|
||||
|
||||
expect(sharedImageCache).toNot.beNil();
|
||||
NSData *imageData = [NSData dataWithContentsOfFile:[self testImagePath]];
|
||||
[self.sharedImageCache storeImageDataToDisk:imageData forKey:kImageTestKey];
|
||||
|
||||
UIImage *storedImageFromMemory = [self.sharedImageCache imageFromMemoryCacheForKey:kImageTestKey];
|
||||
expect(storedImageFromMemory).to.equal(nil);
|
||||
|
||||
NSString *cachePath = [self.sharedImageCache defaultCachePathForKey:kImageTestKey];
|
||||
NSData *storedImageData = [NSData dataWithContentsOfFile:cachePath];
|
||||
expect([storedImageData isEqualToData:imageData]).will.beTruthy;
|
||||
|
||||
[self.sharedImageCache diskImageExistsWithKey:kImageTestKey completion:^(BOOL isInCache) {
|
||||
expect(isInCache).to.equal(YES);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark Helper methods
|
||||
|
||||
- (void)clearAllCaches{
|
||||
[self.sharedImageCache clearDisk];
|
||||
[self.sharedImageCache clearMemory];
|
||||
}
|
||||
|
||||
- (UIImage *)imageForTesting{
|
||||
|
||||
return [UIImage imageWithContentsOfFile:[self testImagePath]];
|
||||
}
|
||||
|
||||
- (NSString *)testImagePath {
|
||||
|
||||
NSBundle *testBundle = [NSBundle bundleForClass:[self class]];
|
||||
return [testBundle pathForResource:@"TestImage" ofType:@"jpg"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ static int64_t kAsyncTestTimeout = 5;
|
|||
- (void)testThatDownloadInvokesCompletionBlockWithCorrectParamsAsync {
|
||||
__block XCTestExpectation *expectation = [self expectationWithDescription:@"Image download completes"];
|
||||
|
||||
NSURL *originalImageURL = [NSURL URLWithString:@"http://static2.dmcdn.net/static/video/656/177/44771656:jpeg_preview_small.jpg?20120509154705"];
|
||||
NSURL *originalImageURL = [NSURL URLWithString:@"http://s3.amazonaws.com/fast-image-cache/demo-images/FICDDemoImage000.jpg"];
|
||||
|
||||
[[SDWebImageManager sharedManager] downloadImageWithURL:originalImageURL options:SDWebImageRefreshCached progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
|
||||
expect(image).toNot.beNil();
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
|
|
@ -1 +1 @@
|
|||
Subproject commit 326b5fb863a43ab8cb225bca913e9025f727f078
|
||||
Subproject commit 1525784d5bc1d9e7e74ff18f9d21a910b60552af
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>3.8.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
//
|
||||
// WebImage.h
|
||||
// WebImage
|
||||
//
|
||||
// Created by Florent Vilmart on 2015-03-14.
|
||||
// Copyright (c) 2015 Dailymotion. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
//! Project version number for WebImage.
|
||||
FOUNDATION_EXPORT double WebImageVersionNumber;
|
||||
|
||||
//! Project version string for WebImage.
|
||||
FOUNDATION_EXPORT const unsigned char WebImageVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <WebImage/PublicHeader.h>
|
||||
|
||||
#import <WebImage/SDWebImageManager.h>
|
||||
#import <WebImage/SDImageCache.h>
|
||||
#import <WebImage/UIImageView+WebCache.h>
|
||||
#import <WebImage/SDWebImageCompat.h>
|
||||
#import <WebImage/UIImageView+HighlightedWebCache.h>
|
||||
#import <WebImage/SDWebImageDownloaderOperation.h>
|
||||
#import <WebImage/UIButton+WebCache.h>
|
||||
#import <WebImage/SDWebImagePrefetcher.h>
|
||||
#import <WebImage/UIView+WebCacheOperation.h>
|
||||
#import <WebImage/UIImage+MultiFormat.h>
|
||||
#import <WebImage/SDWebImageOperation.h>
|
||||
#import <WebImage/SDWebImageDownloader.h>
|
||||
#if !TARGET_OS_TV
|
||||
#import <WebImage/MKAnnotationView+WebCache.h>
|
||||
#endif
|
||||
#import <WebImage/SDWebImageDecoder.h>
|
||||
#import <WebImage/UIImage+WebP.h>
|
||||
#import <WebImage/UIImage+GIF.h>
|
||||
#import <WebImage/NSData+ImageContentType.h>
|
||||
Loading…
Reference in New Issue