What does it mean when it says expected expression before UIAccelerationValue?
//this is the code that I've written. It says "expected expression before UIAccelerationValue" on the part where it says *accelerateValuesAll = UIAccelerationValue开发者_如何转开发.
So, could anybody tell me what the problem is here? How do I fix it?
NSNumber *accelerateValuesALL = UIAccelerationValue.x + UIAccelerationValue.y + UIAccelerationValue.z / 3
NSNumber is a class. You would therefore use it only via explicit messaging, such as:
[accelerateValuesALL floatValue];
Or by implicit Objective-C 2.0 dot notation:
accelerateValuesALL.floatValue;
You appear to want to use a primitive type — that is, one you can use the normal C operators on. So you probably want:
UIAccelerationValue accelerateValuesALL = ...;
Since UIAccelerationValue is a primitive type that UIKit defines for the purposes of passing around acceleration values. It'll just be an alternative name for a float or a double in practice.
精彩评论