Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AFNetworking : the current deployment target does not support automated _weak references

I'm using XCode 4.6.2 and also I'm new to iOS development. I'm trying to install the the AFNetworking library, but I get the following error when I'm trying to use it : "The current deployment target does not support automated _weak references" (when I try to display an image from an URL) in the files AFHTTPClient and AFURLConnectionOperation.

I don't have any weak properties in my little first project but only strong ones.

Any advice would be great!

Thank you

like image 438
Reveclair Avatar asked Apr 22 '13 14:04

Reveclair


2 Answers

Weak references are only supported with iOS 5.0 and later. If your deployment target is set to 4.3 then you can't use weak. The error is probably coming from AFNetworking.

Drop support for iOS 4.3 if you can or don't use AFNetworking.

like image 170
rmaddy Avatar answered Sep 28 '22 02:09

rmaddy


To target the older OS, you can use unsafe_unretained instead of weak in your property declaration, and it should mostly work the same way. weak references nil themselves when their target goes away, but unsafe_unretained leaves open the possibility that the object you're linking to could turn into a dangling pointer when it is deallocated. The latter is the same behavior as if you had used assign as a property declaration in manual memory management.

like image 33
kunalg Avatar answered Sep 28 '22 03:09

kunalg