如何在Objective c中添加"In app Purchase"中的"Touch Id"?

Vai*_*dar 5 objective-c in-app-purchase ios touch-id localauthentication

我已经在我的项目中成功实施了"In App Purchase",现在我正在尝试实施"Touch Id"来购买产品,除了要求"登录iTunes"弹出窗口.在我的代码中,它一个接一个地询问"touch id"和"登录iTunes"弹出窗口,为什么这个连接两件事我只想"触摸id"来购买产品.我已经去了IAP 你如何在iOS应用程序中添加应用内购买?和Touch ID 如何为我的IAP集成Touch ID?但没有得到正确的方法来实现IAP的触摸ID.这是我添加的代码,在此输入图像描述

这可以通过代码实现,也可以在从应用商店购买产品时显示苹果.检查上面的快照,

#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
    {
    }
}
Run Code Online (Sandbox Code Playgroud)

我该怎么做只询问"Touch Id"而不是"登录iTunes"弹出窗口.

flo*_*iep 11

iTunes Store控制它呈现的身份验证类型,而不是您的应用程序.如有必要,将显示警报,否则显示TouchID/FaceID覆盖.

您从未看过TouchID/FaceID覆盖的原因是,在开发过程中,您的应用程序不是使用真正的iTunes Store而是使用沙盒.沙箱环境AFAIK始终显示警报.