I’m programming an iPhone app using Objective-C.
Here’s the error Xcode gives me:
error: assignment of read-only variable 'prop.149'
The code:
// Create CATransition object
CATransition *transition = [CATransition animation];
// Animate over 3/4 of a second
transition.duration = 0.75;
// using the ease in/out timing function
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
// Set transition type
transition.type = kCATransitionPush;
// Next line gives error: assignment of read-only variable 'prop.149'
transition.subtype = (flipsideView.hidden == YES ? kCATransitionFromRight : kCATransitionFromLeft);
What does the error mean, and how do I fix it?
Not sure exactly why, but the compiler is not able to deduce the evaluated type of the result of the ternary operator. Simply adding an explicit cast seems to work:
I’d file this as a compiler bug.