The recommendation is to replace the struct with a class. So you would replace 
x with a class that might look like this:

> @interface ReplaceX : NSObject
> 
> @property (copy) NSString *label;
> @property int value;
> 
> @end

This aside, you should be OK using __unsafe_unretained in an App Store 
application as long as you’re only using constant strings (which won’t be 
released).

Jeff Kelley

On Oct 30, 2011, at 1:32 PM, James Merkel wrote:

> The document on ARC talks about problematic C structs like:
> 
> struct x { NSString *S;  int X; } StaticArray[] = {
>  @"foo", 42,
>  @"bar, 97,
> ...
> };
> 
> I use that pattern quite a bit in my code and haven't had any problems with 
> it. These are basically constant strings that never change.
> 
> With ARC, the compiler wants me to change the code to: 
> 
> struct x { __unsafe_unretained NSString *S; int X; }
> 
> Aside from this looking really ugly, will the App store accept this in an 
> application?
> 
> The document on ARC says in order to do this task correctly, the code should 
> be changed to a class. Ok, what class are they talking about?
> 
> I don't see how the collection classes like NSDictionary or NSArray support 
> this.  Do they mean create your own collection class to do this?
> 
> Thanks for any insight on this.
> 
> Jim Merkel
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to