• 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
Refactor To ARC suggest "weak" attribute for property
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Refactor To ARC suggest "weak" attribute for property


  • Subject: Refactor To ARC suggest "weak" attribute for property
  • From: Andreas Grosam <email@hidden>
  • Date: Fri, 05 Apr 2013 08:50:40 +0200

When using the "Refactor To Objective-C ARC" tool, Xcode suggests to convert from

(@interface Foo)

@property (atomic, readonly) NSError* error;

to

@property (weak, atomic, readonly) NSError* error;


The property is "readonly". Thus, specifying a "weak" attribute makes no sense anyway. Why is Xcode suggesting to specify it weak?


Thanks for clarification!


Further info:

The property itself was originally an *autoreleased* object which will be created in a helper method whenever the property is read. The implementation after converting is as follows:


@implementation Foo


// property readonly error
- (NSError*) error  {
    return [self makeError];
}

// Returns an NSError object
- (NSError*) makeError
{
    error_t imp_error = self.imp->error();  //  error_t is a C struct, imp a C++ instance.
    NSDictionary* userInfoDict = …;
    NSError* error = [NSError errorWithDomain:@"FooError" code:imp_error.code userInfo:userInfoDict];
    return error;
}




Regards
Andreas
 _______________________________________________
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: Refactor To ARC suggest "weak" attribute for property
      • From: Lee Ann Rucker <email@hidden>
  • Prev by Date: Interface Builder
  • Next by Date: Re: Refactor To ARC suggest "weak" attribute for property
  • Previous by thread: Interface Builder
  • Next by thread: Re: Refactor To ARC suggest "weak" attribute for property
  • Index(es):
    • Date
    • Thread