I want to convert NSValue to NSNumber. What is wrong with this code?
char value[4];
[myNSValue getValue:(void*)value];
NSNumber *number = [[NSNumber alloc] initWithBytes:(void*)value objCType:[myNSValue objCType]];
NSTimeInterval duration = [number intValue];
It causes a crash on the last line. What could happen here?
Please read my comment above for further explanation.
To achieve what you want, simply init an NSString with your (char *) and then invoke NSString's intValue. - Assuming you know the type, if not look at the comments below -
Cheers