• 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
Re: Curious about a property being declared in the .h and the .m file for iOS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Curious about a property being declared in the .h and the .m file for iOS


  • Subject: Re: Curious about a property being declared in the .h and the .m file for iOS
  • From: Alex Zavatone <email@hidden>
  • Date: Mon, 15 Jul 2013 14:42:47 -0400

On Jul 15, 2013, at 2:38 PM, Uli Kusterer wrote:

> On Jul 15, 2013, at 8:31 PM, Alex Zavatone <email@hidden> wrote:
>> DownloadOperation.h
>> @interface DownloadOperation : NSOperation
>> - (id)initWithURL:(NSURL*)url;
>> @property (nonatomic, readonly) NSError *error;
>>
>> DownloadOperation.m
>> #import "DownloadOperation.h"
>>
>> @interface DownloadOperation () <NSURLConnectionDelegate>
>> @property (nonatomic, strong) NSURL* url;
>> @property (nonatomic, strong) NSURLConnection* connection;
>> @property (nonatomic, strong) NSMutableData *buffer;
>> @property (nonatomic) long long int expectedContentLength;
>> @property (nonatomic, readwrite) NSError *error;
>
>
> That's not 2 properties, that is one being declared twice, once for external users (in the header) and once for internal use by the class. External users are only supposed to read the property, while the class itself of course has to be able to actually store a value in it, so it redeclares it from readonly to readwrite in a class continuation. This is pretty much the only valid way to declare the same property twice, changing anything else on the property will give an error message, but readonly -> readwrite is OK.
>
> Cheers,
> -- Uli Kusterer
> "The Witnesses of TeachText are everywhere..."
> http://www.zathras.de

Hmm, so if this is the legit form, when I do an @synthesize on error in the .m file, this error appears:

Automatic Reference Counting Issue: ARC forbids synthesizing a property of an Objective-C object with unspecified ownership or storage attribute



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Curious about a property being declared in the .h and the .m file for iOS
      • From: Uli Kusterer <email@hidden>
References: 
 >Curious about a property being declared in the .h and the .m file for iOS (From: Alex Zavatone <email@hidden>)
 >Re: Curious about a property being declared in the .h and the .m file for iOS (From: Uli Kusterer <email@hidden>)

  • Prev by Date: Re: Converting RTFD to Word with embedded images
  • Next by Date: Re: Curious about a property being declared in the .h and the .m file for iOS
  • Previous by thread: Re: Curious about a property being declared in the .h and the .m file for iOS
  • Next by thread: Re: Curious about a property being declared in the .h and the .m file for iOS
  • Index(es):
    • Date
    • Thread