Brandon
Brandon

Reputation: 889

Monotouch - [NSConcreteValue doubleValue]: unrecognized selector sent to instance

This seems like a somewhat vague question - but tapping around in my UI I am getting a 'Unrecognized selector sent to instance '. The stack trace is really not very helpful. In general - what is the best way to debug this in Monodevelop? Any suggestions would be very helpful.

Upvotes: 9

Views: 4478

Answers (2)

xindong
xindong

Reputation: 91

The first answer is not a good solution. The transform.scale should be a double type, if you assign fromValue or toValue of CABasicAnimation a NSValue type, it cann't convert to double value, and so App crashed.

Wrong example:

     animation.fromValue = [NSValue valueWithCGSize:CGSizeMake(0.5, 0.5)];
     animation.toValue = [NSValue valueWithCGSize:CGSizeMake(1.2, 1.2)];

Right example:

     animation.fromValue = @(0.5);
     animation.toValue = @(1.2);

Upvotes: 8

Brandon
Brandon

Reputation: 889

Rolf's link revealed the correct answer. Changed:

CABasicAnimation scale_animation = CABasicAnimation.FromKeyPath("transform.scale");

to:

CABasicAnimation scale_animation = CABasicAnimation.FromKeyPath("transform");

Thanks!

Upvotes: 24

Related Questions