Strange error: assignment of read-only variable 'prop.1386'

Discussion in 'iOS Programming' started by idelovski, Nov 12, 2011.

  1. idelovski macrumors regular

    Sep 11, 2008
    Can someone please explain this error: assignment of read-only variable 'prop.1386'

    I get it for the last line of this piece of code:

    - (BOOL)goingBackwards
       return (goingBackwardsFlag);
    CATransition  *trans = [CATransition animation];
    trans.subtype = [self goingBackwards] ? kCATransitionFromLeft : kCATransitionFromRight;
    But, if I rewrite it like this I don't get the error and all is fine:

    if ([self goingBackwards])
       trans.subtype = kCATransitionFromLeft;
       trans.subtype = kCATransitionFromRight;
    Googling for prop.1386 didn't bring anything useful. I have now code that compiles, but I'd like to know what was wrong with the first version.
  2. chown33 macrumors 604

    Aug 9, 2009
    What does this do?
    trans.subtype = ( [self goingBackwards] ? kCATransitionFromLeft : kCATransitionFromRight );

    Kinda curious why goingBackwards isn't declared as a read-only property, synthesized to use goingBackwardsFlag as the ivar.
  3. idelovski, Nov 13, 2011
    Last edited: Nov 13, 2011

    idelovski thread starter macrumors regular

    Sep 11, 2008
    >What does this do?

    Nothing. The absurdity of the problem is not that my flag variable is read only or something like that. I can even do this:

    - (BOOL)goingBackwards_1
       return (YES);
    trans.subtype = [self goingBackwards_1] ? kCATransitionFromLeft : kCATransitionFromRight;
    ... and it still produced the same error.

    On the other hand, this is all fine and cool:

    NSString  *tmpStr = [self goingBackwards] ? kCATransitionFromLeft : kCATransitionFromRight;


    Seem to be something with GCC 4.2 in the Xcode 3.2.6. If I move the project to another Mac with Xcode 4 and sdk 5, the problem disappears.

Share This Page