インポートしたIOS6SDKでXcode4.2を実行しています(古いMacではXCode 4.5を実行できません)。私のアプリは、iOS展開ターゲット4.3、ベースSDK 6.0、およびarmv7のアーキテクチャのみで構成されています。
以前に動作していたアプリを更新して、ユーザーのアドレス帳にアクセスする許可を要求しようとしています。これは、現在iOS 6の要件です(新しいiOS 6機能を使用)。残念ながら、次のAppleMach-Oリンカーエラーが発生します。
Ld / Users / Blake / Library / Developer / Xcode / DerivedData / MyApp-ercibgqhpidlmwflixmwbvruyctz / Build / Products / Debug-iphoneos / MyApp.app / MyApp normal armv7 cd / Users / Blake / Desktop / MyApp / MyApp setenv IPHONEOS_DEPLOYMENT_R /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin "/Developer/Platforms/iPhoneOS.platform/Developer/usr / bin / clang -arch armv7 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -L / Users / Blake / Library / Developer / Xcode / DerivedData / MyApp-ercibgqhpidlmwflixmwbvruyctz / Build / Products /デバッグ-iphoneos-L/ Users / Blake / Desktop / MyApp / MyApp /../../ ../ Downloads / ScannerKit-Latest / Demo / Libraries / ScannerKit -F / Users / Blake / Library / Developer / Xcode / DerivedData / MyApp-ercibgqhpidlmwflixmwbvruyctz / Build / Products / Debug-iphoneos -filelist / Users / Blake / Library / Developer / Xcode /DerivedData/MyApp-ercibgqhpidlmwflixmwbvruyctz/Build/Intermediates/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/armv7/MyApp.LinkFileList -dead_strip -all_load -lstdc ++ -fobjc-arc -miphoneos-version-min = 4.3 -framework AddressBook -framework AddressBookUI -framework UIKit -framework Foundation -framework CoreGraphics -lScannerKit -framework AVFoundation -framework CoreMedia -framework SystemConfiguration -framework CoreVideo -liconv -framework AudioToolbox -framework QuartzCore -o / Users / Blake / Library / Developer / Xcode / DerivedData / MyApp-ercibgqhpidlmwflixmwbvruyctz / Build / Products / Debug-iphoneos / MyApp.app / MyAppapp / MyAppapp / MyAppbuild / Objects-normal / armv7 / MyApp.LinkFileList -dead_strip -all_load -lstdc ++ -fobjc-arc -miphoneos-version-min = 4.3 -framework AddressBook -framework AddressBookUI -framework UIKit -framework Foundation -framework CoreGraphics -lScannerKit -framework AVFoundation-フレームワークCoreMedia-frameworkSystemConfiguration -framework CoreVideo -liconv -framework AudioToolbox -framework QuartzCore -o / Users / Blake / Library / Developer / Xcode / DerivedData / MyApp-ercibgqhpidlmwflixmwbvruyctz / Build / Products / Debug-iphoneos / MyApp.app / MyAppbuild / Objects-normal / armv7 / MyApp.LinkFileList -dead_strip -all_load -lstdc ++ -fobjc-arc -miphoneos-version-min = 4.3 -framework AddressBook -framework AddressBookUI -framework UIKit -framework Foundation -framework CoreGraphics -lScannerKit -framework AVFoundation-フレームワークCoreMedia-frameworkSystemConfiguration -framework CoreVideo -liconv -framework AudioToolbox -framework QuartzCore -o / Users / Blake / Library / Developer / Xcode / DerivedData / MyApp-ercibgqhpidlmwflixmwbvruyctz / Build / Products / Debug-iphoneos / MyApp.app / MyApp3 -framework AddressBook -framework AddressBookUI -framework UIKit -framework Foundation -framework CoreGraphics -lScannerKit -framework AVFoundation -framework CoreMedia -framework SystemConfiguration -framework CoreVideo -liconv -framework AudioToolbox -framework QuartzCore -o / Users / Blake / Library / Developer / Xcode /DerivedData/MyApp-ercibgqhpidlmwflixmwbvruyctz/Build/Products/Debug-iphoneos/MyApp.app/MyApp3 -framework AddressBook -framework AddressBookUI -framework UIKit -framework Foundation -framework CoreGraphics -lScannerKit -framework AVFoundation -framework CoreMedia -framework SystemConfiguration -framework CoreVideo -liconv -framework AudioToolbox -framework QuartzCore -o / Users / Blake / Library / Developer / Xcode /DerivedData/MyApp-ercibgqhpidlmwflixmwbvruyctz/Build/Products/Debug-iphoneos/MyApp.app/MyApp
アーキテクチャarmv7の未定義のシンボル:
" _ ABAddressBookRequestAccessWithCompletion "、参照元:-[ServerConnect parserDidEndDocument:] in ServerConnect.o " _ABAddressBookGetAuthorizationStatus "、参照元:-[ServerConnect parserDidEndDocument:] in ServerConnect.o " _ABAddressBookCreateWithOptions "、参照元:-[ServerConnect ServerConnect.oのparserDidEndDocument:] ld:アーキテクチャarmv7のシンボルが見つかりませんclang:エラー:リンカーコマンドが終了コード1で失敗しました(呼び出しを確認するには-vを使用してください)
私の推測では、XCode 4.2は、アーキテクチャarmv7のiPhoneOS6.0.sdkではなくiPhoneOS5.0.sdkを探しています。ただし、この問題をどこで修正できるかわかりません。他の誰かが以前にこの問題に遭遇したことがありますか?事前に助けてくれてありがとう!
私のコード(参照用):
// Fetch the address book
//Check if we are using iOS6
if ([self isABAddressBookCreateWithOptionsAvailable]) {
ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(NULL, NULL);
if (ABAddressBookGetAuthorizationStatus() == 0) {
ABAddressBookRequestAccessWithCompletion(addressBook, ^(bool granted, CFErrorRef error) {
// First time access has been granted
[self searchForPersonInAddressBook:addressBook withName:fullName];
});
}
else if (ABAddressBookGetAuthorizationStatus() == 3) {
// The user has previously given access
[self searchForPersonInAddressBook:addressBook withName:fullName];
}
else {
// The user has previously denied access
UIAlertView *deniedAccess=[[UIAlertView alloc] initWithTitle:@"Unable to Access Address Book" message:@"Change App Privacy Settings" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[deniedAccess show];
}
}
//If using iOS 4/5
else {
ABAddressBookRef addressBook = ABAddressBookCreate();
[self searchForPersonInAddressBook:addressBook withName:fullName];
}
}
- (void)searchForPersonInAddressBook:(ABAddressBookRef )ab
withName:(NSString *)fn
{
// Search for the person in the address book
CFArrayRef person = ABAddressBookCopyPeopleWithName(ab, (__bridge CFStringRef)fn);
// Display message if person not found in the address book
if ((person != nil) && (CFArrayGetCount(person) == 0)) {
// Show an alert if name is not in Contacts
UIAlertView *saveContact=[[UIAlertView alloc] initWithTitle:@"Save New Contact to iPhone?" message:fn delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Save!", nil];
saveContact.tag = 2;
[saveContact show];
}
}
- (BOOL)isABAddressBookCreateWithOptionsAvailable
{
return &ABAddressBookCreateWithOptions != NULL;
}