Comments (12)
This is to allow compilation with old SDK (<4.0). This is certainly no longer needed but it doesn't hurt I guess.
from sdwebimage.
This is to allow compilation with old SDK (<4.0). ==> that's exactly what the #if does ;-) Maybe I've not be very explicit. I talked about the if ([device respondsToSelector ..., not the #if. I think it's useless to have the both checks.
This is certainly no longer needed but it doesn't hurt I guess. ==> I guess too. I was reading your class to help me writing my own cache with GCD and Blocks and because I do not like useless code I took 1 min to report it to you ^^
Cheers,
from sdwebimage.
The runtime condition is for when compile for 4.0+ and run it on 3.x
from sdwebimage.
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_4_0 ==> compile time check, the code will not be executed on device running on 3.x, and can be compiled for those devices => everything is OK.
On device running on 4.0+, the key UIApplicationDidEnterBackgroundNotification will be defined and the notification handler will be called only if the device support multitasking => so the runtime check is useless
PS: excusez moi d'insister c'est juste pour clarifier mes propos et surtout être sûr que je ne me plante pas... On peut continuer cette conversation par mail ([email protected]) si vous voulez ;-)
from sdwebimage.
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_4_0 ==> compile time check, the code will not be executed on device running on 3.x […]
I think you may be wrong here: if the code is compiled with 4.0+ SDK, it can still be executed on devices running 3.0 depending on deployment version setting. On those devices, the UIDevice's isMultitaskingSupported selector won't be defined and calling it without runtime check will lead to a crash.
from sdwebimage.
Maybe I'm wrong... I wanted to make some tests to confirm that, but the code in the #if is never executed...
I'm probably too tired. I'll give it a try another day and keep you posted ^^
from sdwebimage.
Ok, I'm interested by the result of your test. In the meantime, I keep the code that way. Thanks.
from sdwebimage.
Ok.
In the meantime check out this great blog post => http://mattgemmell.com/2011/12/05/latest-version/
Ok ok, it's a big dilema with apps like yours but you could drive huge amounts of users to update their phone and help all developers to not gone crazy with that kinds of segmentation issues.
;-)
from sdwebimage.
I saw this blog post. I don't totaly agree with it but this is subjective feeling. Anyways, I think it's not the role of a low level library to decide which version of iOS your app will support. Its role is to make sure it will do all the extra-work to ensure it will complet its task in all circonstances. It's why I don't rush on ARC, blocks and GCD for this project as ROI isn't evident.
from sdwebimage.
That's a good point.
I'm agree with you for ARC, but not so much for GCD and blocks because there were introduced with iOS 4.0 and I don't know the exact percentage of users on iOS 3.x but it is really really low, and for me the ROI is evident ;-)
Bye
from sdwebimage.
You mean in term of performance or ease of use? Because in term of perf, I'm not convinced it would change anything actually. If you implement GCD, I would be interested by a comparative bench to see if my feelings were right :)
from sdwebimage.
I mean in ease of use, but a bench could be cool ;-)
I'll finish my library, test it a lot and then push it on github.
Could you make the bench? I didn't have to do it before the next few weeks...
from sdwebimage.
Related Issues (20)
- Set UIImageView.sd_imageTransition, new image request cannot cancel the animation of the previous request HOT 13
- 部分jpg图片链接无法显示的问题,channelPicUrlImgView.sd_setImage(with: URL(string: model?.channelPicUrl ?? ""), placeholderImage: UIImage(named: "placeholder.png")) HOT 8
- Deprecation of the UIGraphicsBeginImageContextWithOptions in Xcode15 #2200 HOT 2
- Error installing SDWebImage HOT 1
- iOS17 privacy policy HOT 3
- issue with `SDImageCache.sharedImageCache` HOT 32
- Replace NSFileManager.enumeratorAtPath with enumeratorAtURL HOT 1
- NSCoding Cyber Security Issue Founding: any Remediation? HOT 2
- Report an error: UIImageView+WebCache.m normal arm64 objective-c HOT 1
- Which version of SDWebImage is the most stable? HOT 1
- About PrivacyInfo.xcprivacy
- 隐私清单 HOT 1
- Using Apple's ImageIO on iOS 17 cause APNG pictures flicker abnormally HOT 17
- Image cache behavior question HOT 2
- iOS 12.1.2 heic 解码失败 HOT 1
- Crashing while setting force decode policy. HOT 6
- [Crash] - [NSConcreteData dealloc] EXC_BAD_ACCESS (KERN_INVALID_ADDRESS) HOT 1
- 5.18.4+ SDAnimatedImage static image support performance issue HOT 11
- Binary makes use of insecure APIs: sscanf,malloc functions HOT 1
- App Rejected due to ITMS-91065: Missing signature in SDWebImage HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdwebimage.