I have successfully implemented "In App Purchase" in my project and now i am trying to implement a "Touch Id" to buy a product except asking a "Sign in to iTunes" popup. Here in my code it asks "touch id" and "Sign in to iTunes" popup both one after another, why this one wired both things i want only "touch id" to buy product. I have gone for IAP How do you add an in-app purchase to an iOS application? and for Touch ID How do i integrate Touch ID for my IAP? but not getting proper way to implement a touch id for IAP.Here is the code i have added,
Is this possible through code or it shows apple at the time of buying a product from app store. Check above snapshot,
#import <LocalAuthentication/LocalAuthentication.h>
-(void) localAunthentication
{
//LocalAuthentication
LAContext *authContext = [[LAContext alloc] init];
NSError *authError = nil;
NSString *authLocalizedReasonString = @"Please aunthenticate to proceed";
if ([authContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError])
{
[authContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:authLocalizedReasonString
reply:^(BOOL success, NSError *error)
{
if (success)
{
// Allocated here for succinctness.
NSOperationQueue *operationQueue = [[NSOperationQueue alloc] init];
[operationQueue addOperationWithBlock: ^
{
}];
}
else
{
switch (error.code)
{
case LAErrorAuthenticationFailed:
//Authentication Failed
break;
case LAErrorUserCancel:
break;
case LAErrorUserFallback:
break;
default:
//Touch ID is not configured
break;
}
NSLog(@"%@",error.localizedDescription);
}
}];
}
else
{
}
}
What should i do to asks only "Touch Id" instead of "Sign in To iTunes" popup.
The iTunes Store controls what kind of authentication it presents, not your app. If necessary, an alert will be presented, otherwise the TouchID/FaceID overlay.
The reason you're never seeing the TouchID/FaceID overlay is that during development, your app is not using the real iTunes Store but a sandbox. The sandbox environment, AFAIK, always presents an alert.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With