Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ARC Strong property Enumeration Error

Tags:

I have the following code and am getting this error before compiling:

Fast Enumeration Variables can't be modified in ARC by default, declare the variable _strong to allow this

for (NSString *name in array){
        @try {
            S3ObjectController *localS3 = [[S3ObjectController alloc]init];
            name = localS3.stringProperty;
}

In this S3ObjectController class, I have the property declared like this:

@property (nonatomic, strong)  NSString *stringProperty;

How should I change the property? I thought I was declaring it strong?

like image 744
Eric Avatar asked Jan 23 '12 15:01

Eric


1 Answers

It means declare the fast enumeration variable strong, not your instance variable:

for (NSString __strong *name in array) {
    @try {
        S3ObjectController *localS3 = [[S3ObjectController alloc]init];
        name = localS3.stringProperty;
    }
}
like image 140
Stuart Avatar answered Sep 23 '22 21:09

Stuart