• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
readonly IBOutlet autosynthesized property new warning
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

readonly IBOutlet autosynthesized property new warning


  • Subject: readonly IBOutlet autosynthesized property new warning
  • From: Roland King <email@hidden>
  • Date: Wed, 30 Jan 2013 18:34:31 +0800

I've been using this pattern for some time now

ClassName.h file

@property( readonly ) IBOutlet UIView  *someView; // declare readonly

ClassName.m file

// class extension
@interface ClassName()
@property( readwrite ) IBOutlet UIView  *someView; // redeclare readwrite
@end

// no @synthesize statements since Xcode 4.3, not needed. 

So that the NIB set properties appear to users to be readonly, which I want them to be, but the class itself can set them in code as they are redefined readwrite in a class extension and the NIB loader would find the setSomeView: method and call it or fall back to the underlying _variable (as documented in Accessor Search Implementation Details). That's worked fine thus far. 

Now I get the following warning compiling the .m file

"Readonly IBOutlet property when auto-synthesized may not work correctly with 'nib' loader"

Why? What's it not potentially doing now which it was doing before, or potentially wasn't doing before and I was lucky? I find that if I use this pattern and get the warning, I can still put the following

self.someView = someOtherView; 

in the body of the .m file and there's no compile warning there, and it works, so there appears to be a mutator auto-synthesized, which the NIB loader would also be able to use surely? 

I lastly find that being explicit with @synthesized removes the warning .. 

@synthesize someView = _someView; 

Why would that make a difference? 
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: readonly IBOutlet autosynthesized property new warning
      • From: Joar Wingfors <email@hidden>
  • Prev by Date: Re: macro warnings in Xcode 4.6
  • Next by Date: Multiple Pre-Compiled Headers?
  • Previous by thread: Re: macro warnings in Xcode 4.6
  • Next by thread: Re: readonly IBOutlet autosynthesized property new warning
  • Index(es):
    • Date
    • Thread