We can check if that specific method available in this version of sdk or not.
For example there is method AVCaptureAutoFocusRangeRestriction of class AVCaptureDevice which is available in iOS 7 but not in iOS 6. So to check we can do the following :
SEL sel = @selector(setAutoFocusRangeRestriction:);
if([device respondsToSelector:sel])
{
// calling function available in iOS 7
NSInvocation *inv = [NSInvocation invocationWithMethodSignature:[device methodSignatureForSelector:sel]];
[inv setSelector:sel];
[inv setTarget:device];
int AVCaptureAutoFocusRangeRestrictionFarValue = 2;
[inv setArgument:&AVCaptureAutoFocusRangeRestrictionFarValue atIndex:2];
[inv invoke];
}
else
{
call function available in iOS 6
}
0 Comment(s)