我正在使用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 -filelist /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 -lddc ++ -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/HWC.build/Debug-iphoneos/HWC.build/Objects-normal/armv7/HWC_depende ncy_info.dat -o /Users/i307466/Downloads/OneBridge/trunk/Apps/iPhone/WorkFlow/build/HWC.build/Debug-iphoneos/HWC.build/Objects-normal/armv7/HWC
架构armv7的未定义符号: " _OBJC_CLASS _ $ _ LAContext",引自: HWCAppDelegate.o中的objc-class-ref ld:找不到架构armv7的符号 clang:错误:链接器命令失败,退出代码为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 -filelist /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 -lddc ++ -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/HWC.build/Debug-iphoneos/HWC.build/Objects-normal/arm64/HWC_depende ncy_info.dat -o /Users/i307466/Downloads/OneBridge/trunk/Apps/iPhone/WorkFlow/build/HWC.build/Debug-iphoneos/HWC.build/Objects-normal/arm64/HWC
架构arm64的未定义符号: " _OBJC_CLASS _ $ _ LAContext",引自: HWCAppDelegate.o中的objc-class-ref ld:找不到架构arm64的符号 clang:错误:链接器命令失败,退出代码为1(使用-v查看调用) 的
答案 0 :(得分:11)
您似乎没有链接LocalAuthentication.framework。将其添加到Xcode中的应用程序目标(常规 - >链接框架和库 - > + - > LocalAuthentication.framework)。