LiteWait
LiteWait

Reputation: 634

Xcode 4 ARC recheck error - "changes retain/release properties of pointer"

Trying pass the recheck of ARC conversion, but I am not sure how to fix this issue. The method and the property are at odds and I am not sure what to do here:

- (void)getObjects:(id *)objects andKeys:(id *)keys {
     return [self.items getObjects:objects andKeys:keys];
}

@interface SoapArray : SoapObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration> {
      NSMutableArray* items;
}

@property (nonatomic, retain) NSMutableArray* items;

ERRORS WITH:

Sending '__autoreleasing id *' to parameter of type '__unsafe_unretained id *' changes retain/release properties of pointer

Upvotes: 3

Views: 2902

Answers (1)

Rob Napier
Rob Napier

Reputation: 299355

You need to update your signature to match the new ARC-compatible getObjects:andKeys:

- (void)getObjects:(id __unsafe_unretained [])objects andKeys:(id __unsafe_unretained [])keys;

The default memory semantic here would be __autoreleasing, but this method returns __unsafe_unretained objects, so you need to as well.

Keep in mind that these are __unsafe_unretained. When you get back your array of id, they have no memory management applied to them. So if self goes away, these objects probably will, too (and they won't zero the pointers like a weak property). That's usually ok and what you want, but keep it in mind.

Upvotes: 4

Related Questions