Reputation: 261
I am using Xcode6-beta5 to integrate touch ID authentication into my own application.Running on real device iphone5s(iOS8-beta5), using the following code. Already #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
}
But when I compile and run it shows build failed:
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 -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/HWC.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.build/Objects-normal/armv7/HWC
Undefined symbols for architecture armv7: "_OBJC_CLASS_$_LAContext", referenced from: objc-class-ref in HWCAppDelegate.o ld: symbol(s) not found for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)
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 -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/HWC.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.build/Objects-normal/arm64/HWC
Undefined symbols for architecture arm64: "_OBJC_CLASS_$_LAContext", referenced from: objc-class-ref in HWCAppDelegate.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Upvotes: 3
Views: 3158
Reputation: 930
It doesn't appear that you're linking LocalAuthentication.framework. Add it to your app's target in Xcode (General->Linked Frameworks and Libraries->+->LocalAuthentication.framework).
Upvotes: 13