3

我正在使用 Xcode6-beta5 将触摸 ID 身份验证集成到我自己的应用程序中。在真实设备 iphone5s(iOS8-beta5) 上运行,使用以下代码。已经#import。

LAContext *myContext = [[LAContext alloc] init];
NSError *authError = nil;
NSString *myLocalizedReasonString = @"use touch id to unlock app";

if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {
     [myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
               localizedReason:myLocalizedReasonString
                         reply:^(BOOL success, NSError *error) {
                            if (success) {
                               UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"success" message:@"pass auth" delegate:self cancelButtonTitle:NSLocalizedString(@"OK", @"OK button") otherButtonTitles:nil];

                               [alert show];
                               [alert release];

                               // User authenticated successfully, take appropriate action
                            } else {
                               UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"fail" message:@"fail auth" delegate:self cancelButtonTitle:NSLocalizedString(@"OK", @"OK button") otherButtonTitles:nil];

                               [alert show];
                               [alert release];
                               // User did not authenticate successfully, look at error and take appropriate action
                            }
                         }];
  } else {
     // Could not evaluate policy; look at authError and present an appropriate message to user
  }

但是当我编译并运行它显示构建失败:

ld build/HWC.build/Debug-iphoneos/HWC.build/Objects-normal/armv7/HWC normal armv7 cd /Users/i307466/Downloads/OneBridge/trunk/Apps/iPhone/WorkFlow export IPHONEOS_DEPLOYMENT_TARGET=8.0 export PATH="/ Applications/Xcode6-Beta5.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode6-Beta5.app/Contents/Developer/usr/bin:/usr/bin:/bin:/ usr/sbin:/sbin" /Applications/Xcode6-Beta5.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /Applications/Xcode6-Beta5.app/Contents/Developer/Platforms /iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk -L/Users/i307466/Downloads/OneBridge/trunk/Apps/iPhone/WorkFlow/build/Debug-iphoneos -F/Users/i307466/Downloads/OneBridge/trunk/Apps/iPhone/WorkFlow/build/Debug-iphoneos -文件列表 /Users/i307466/Downloads/OneBridge/trunk/Apps/iPhone/WorkFlow/build/HWC.build/Debug-iphoneos/HWC.build/Objects-normal/armv7/HWC.LinkFileList -Xlinker -map -Xlinker /Users/ i307466/Downloads/OneBridge/trunk/Apps/iPhone/WorkFlow/build/HWC.build/Debug-iphoneos/HWC.build/HWC-LinkMap-normal-armv7.txt -dead_strip -all_load ../../../ Pioneer/MOClients/iPhone/build/Debug-iphoneos/libMO.a ../../../Pioneer/Robie/Device/iPhone/Datavault/build/Debug-iphoneos/libDatavault.a ../../. ./TPTools/iOS/afaria/libs/Debug-iphoneos/libAfariaSLL.a ../../../TPTools/PhoneGap/iOS/CordovaLib/build/Debug-iphoneos/libCordova.a ../../. ./TPTools/iOS/ClientUtil/Libraries/Debug-iphoneos/libsupClientUtil.a ../../../TPTools/iOS/ClientUtil/Libraries/Debug-iphoneos/libSUPSupportability.a ../../../TPTools/iOS/ClientUtil/Libraries/Debug-iphoneos/libPerformanceLib.a 。 ./../../Pioneer/Robie/Device/iPhone/Widgets/HWCLib/build/Debug-iphoneos/libHWC.a ../../../TPTools/OpenSSL/iOS/Debug-iphoneos/libcrypto。 a -fobjc-link-runtime -miphoneos-version-min=8.0 -lstdc++.6.0.9 -framework CoreTelephony -lz.1.2.5 -lstdc++ -framework CoreGraphics -framework CFNetwork -framework Foundation -framework MobileCoreServices -framework QuartzCore -framework Security -framework UIKit -licucore.A -framework AddressBook -framework CoreMedia -framework AudioToolbox -framework AVFoundation -framework CoreLocation -framework AddressBookUI -framework SystemConfiguration -Xlinker -dependency_info -Xlinker /Users/i307466/Downloads/OneBridge/trunk/Apps/iPhone/WorkFlow /构建/硬件。build/Debug-iphoneos/HWC.build/Objects-normal/armv7/HWC_dependency_info.dat -o /Users/i307466/Downloads/OneBridge/trunk/Apps/iPhone/WorkFlow/build/HWC.build/Debug-iphoneos/HWC。构建/对象-正常/armv7/HWC

架构 armv7 的未定义符号:“_OBJC_CLASS_$_LAContext”,引用自:HWCAppDelegate.o ld 中的 objc-class-ref:未找到架构 armv7 的符号:错误:链接器命令失败,退出代码为 1(使用 -v查看调用)

ld build/HWC.build/Debug-iphoneos/HWC.build/Objects-normal/arm64/HWC normal arm64 cd /Users/i307466/Downloads/OneBridge/trunk/Apps/iPhone/WorkFlow export IPHONEOS_DEPLOYMENT_TARGET=8.0 export PATH="/ Applications/Xcode6-Beta5.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode6-Beta5.app/Contents/Developer/usr/bin:/usr/bin:/bin:/ usr/sbin:/sbin" /Applications/Xcode6-Beta5.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -isysroot /Applications/Xcode6-Beta5.app/Contents/Developer/Platforms /iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk -L/Users/i307466/Downloads/OneBridge/trunk/Apps/iPhone/WorkFlow/build/Debug-iphoneos -F/Users/i307466/Downloads/OneBridge/trunk/Apps/iPhone/WorkFlow/build/Debug-iphoneos -文件列表 /Users/i307466/Downloads/OneBridge/trunk/Apps/iPhone/WorkFlow/build/HWC.build/Debug-iphoneos/HWC.build/Objects-normal/arm64/HWC.LinkFileList -Xlinker -map -Xlinker /Users/ i307466/Downloads/OneBridge/trunk/Apps/iPhone/WorkFlow/build/HWC.build/Debug-iphoneos/HWC.build/HWC-LinkMap-normal-arm64.txt -dead_strip -all_load ../../../ Pioneer/MOClients/iPhone/build/Debug-iphoneos/libMO.a ../../../Pioneer/Robie/Device/iPhone/Datavault/build/Debug-iphoneos/libDatavault.a ../../. ./TPTools/iOS/afaria/libs/Debug-iphoneos/libAfariaSLL.a ../../../TPTools/PhoneGap/iOS/CordovaLib/build/Debug-iphoneos/libCordova.a ../../. ./TPTools/iOS/ClientUtil/Libraries/Debug-iphoneos/libsupClientUtil.a ../../../TPTools/iOS/ClientUtil/Libraries/Debug-iphoneos/libSUPSupportability.a ../../../TPTools/iOS/ClientUtil/Libraries/Debug-iphoneos/libPerformanceLib.a 。 ./../../Pioneer/Robie/Device/iPhone/Widgets/HWCLib/build/Debug-iphoneos/libHWC.a ../../../TPTools/OpenSSL/iOS/Debug-iphoneos/libcrypto。 a -fobjc-link-runtime -miphoneos-version-min=8.0 -lstdc++.6.0.9 -framework CoreTelephony -lz.1.2.5 -lstdc++ -framework CoreGraphics -framework CFNetwork -framework Foundation -framework MobileCoreServices -framework QuartzCore -framework Security -framework UIKit -licucore.A -framework AddressBook -framework CoreMedia -framework AudioToolbox -framework AVFoundation -framework CoreLocation -framework AddressBookUI -framework SystemConfiguration -Xlinker -dependency_info -Xlinker /Users/i307466/Downloads/OneBridge/trunk/Apps/iPhone/WorkFlow /构建/硬件。build/Debug-iphoneos/HWC.build/Objects-normal/arm64/HWC_dependency_info.dat -o /Users/i307466/Downloads/OneBridge/trunk/Apps/iPhone/WorkFlow/build/HWC.build/Debug-iphoneos/HWC。构建/对象-正常/arm64/HWC

架构 arm64 的未定义符号:“_OBJC_CLASS_$_LAContext”,引用自:HWCAppDelegate.o ld 中的 objc-class-ref:未找到架构 arm64 的符号 clang:错误:链接器命令失败,退出代码为 1(使用 -v查看调用)

4

1 回答 1

13

您似乎没有链接 LocalAuthentication.framework。将它添加到 Xcode 中的应用程序目标(General->Linked Frameworks and Libraries->+->LocalAuthentication.framework)。

于 2014-08-12T04:27:08.740 回答