1

I am creating my first static Cocoa Library, and I have noticed a curious thing compared to when I work with Cocoa Applications: When I add an IBOulet to a view in a xib file, the property is made unsafe_unretained by default instead of weak.

Is there any harm done in changing unsafe_unretained to weak?

Thanks, Michael Knudsen

Michael Knudsen
  • 629
  • 1
  • 7
  • 23
  • possible duplicate of [Differences between weak and unsafe\_unretained](http://stackoverflow.com/questions/11121839/differences-between-weak-and-unsafe-unretained) – occulus Apr 07 '14 at 12:00
  • It's a setting somewhere in a popup menu in interface builder. You need to find that popup menu and change it to what you want. You should _know_ what kind of reference you want and use that kind of reference. If you are asking about the harm, then you don't know and shouldn't use unsafe_unretained. Between "weak" and "strong", they have different purposes and you need to _know_ what is right for you and use that. – gnasher729 Apr 07 '14 at 12:33
  • I know the difference between weak and strong, and I know that weak is right for me. However, this is the first time I am dealing with a static library (totally new concept to me). I was wondering if there were some special memory issues to consider, since weak wasn't the default for an IBOutlet. I have never come across unsafe_retained before. – Michael Knudsen Apr 07 '14 at 13:01

1 Answers1

0

It happened to me too. i believe that if you'll change it to weak, you won't be able to compile it, because this library (or inner sub libraries) are deployed to an old xcode, which only support unsafe_unretained, but not in weak. you can change the deployment in the right sidebar.

yonivav
  • 994
  • 11
  • 18