Test if ARC is on, and fail with an #error if not.
This is done in a source file, not a header, so it imposes no constraints on the calling code.
This may be worth adding to each source file, but I thought I'd start with a central one.
Add error when building without ARC to a central file.
Throw a build failure if not compiled with ARC (boosted from AFNetwor…
Come to think of it __has_feature is NSHipster blog-worthy. Given all of the confusion about AFN recently with the switch to ARC, this snippet should be included in every open source project using ARC. Good stuff. Thanks!
I hadn't heard of NSHipster, and I'm now following it. So thanks for the pointer, too!
Mattt, the more I think of this, the more I think it's a good addition to every source file. The reason is just that the user/developer can technically satisfy the check by adding -fobjc-arc to just that one file. While that might seem like a crazy case, it'd be pretty easy to miss one of the AFNetworking files.
Also, some of the add-ons still require ARC be off.
I think I'm fine with just having the error in a single class, at least for now. If people are still asking about ARC support after this change, we can consider more drastic measures.
As for the addons, I'll work to get those all ARC-ified so that they're all internally-consistent.
Sounds good. My guess is that error will reduce the problem by 80% or more. What's left should be manageable.