小编Vai*_*dar的帖子

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

我已经在我的项目中成功实施了"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: …
Run Code Online (Sandbox Code Playgroud)

objective-c in-app-purchase ios touch-id localauthentication

5
推荐指数
1
解决办法
1129
查看次数