Estimote SDK 的未定义符号链接器失败

Undefined symbol linker failure for Estimote SDK

我正在尝试将 Estimote SDK 3.0 包含到我的项目中,但出现以下链接错误:

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_ESTBeaconRegionWrapper", referenced from:
      objc-class-ref in EstimoteSDK(ESTSecureBeaconManager.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我已将框架添加到 'Build phase' 并检查框架搜索目录设置是否包含该目录。

我从 Estimote 下载了示例应用程序,它使用相同的框架(这是我从中复制的)并且构建良好。我看不出任何明显的区别。

我怎样才能找出问题所在?

编辑: 我正在使用 Xcode 6.2。 我正在构建 iPhone 6(表示架构 arm64、armv7、armv7s)。在我为 armv7s 构建下面的问题之后,我得到了同样的错误(对于 armv7s)。所以一定是框架链接有问题

编辑 2:我删除了 -ObjC 'Other linker flag',因为将其添加到 Estimote 项目会产生相同的错误。但是现在我得到了更多的错误:

Ld /Users/.../iDomsPortalDev normal arm64
    cd "/Users/.../idoms-portal"
    export IPHONEOS_DEPLOYMENT_TARGET=7.0
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.2.sdk -L/Users/.../Products/Debug-iphoneos -F/Users/.../Products/Debug-iphoneos -FiDoms/frameworks -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -filelist /Users/.../Debug-iphoneos/iDoms\ Dev.build/Objects-normal/arm64/iDomsPortalDev.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -lxml2 -lc++ -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=7.0 -framework CrashReporter -framework EstimoteSDK -weak_framework Accelerate -weak_framework Social -weak_framework Twitter -framework MessageUI -framework MapKit -framework AVFoundation -framework SystemConfiguration -framework MediaPlayer -framework QuartzCore -framework UIKit -framework Foundation -framework CoreGraphics -framework CoreData -framework CoreLocation -Xlinker -dependency_info -Xlinker /Users/.../Debug-iphoneos/iDoms\ Dev.build/Objects-normal/arm64/iDomsPortalDev_dependency_info.dat -o /Users/.../iDomsPortalDev

Undefined symbols for architecture arm64:
  "_CBAdvertisementDataServiceDataKey", referenced from:
      +[ESTDeviceDataHelper parseAdvertisingData:] in EstimoteSDK(ESTDeviceDataHelper.o)
  "_OBJC_CLASS_$_CBCentralManager", referenced from:
      objc-class-ref in EstimoteSDK(ESTBeaconDevice.o)
  "_kSecAttrService", referenced from:
      -[ESTKeychain dataForKey:] in EstimoteSDK(ESTKeychain.o)
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
      +[ESTKeychain bundleSeedID] in EstimoteSDK(ESTKeychain.o)
  "_kSecAttrAccessibleAfterFirstUnlock", referenced from:
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
  "_OBJC_CLASS_$_CBUUID", referenced from:
      objc-class-ref in EstimoteSDK(ESTBeaconDevice.o)
      objc-class-ref in EstimoteSDK(ESTBluetoothServiceAuth.o)
      objc-class-ref in EstimoteSDK(ESTBluetoothServiceEstimote.o)
      objc-class-ref in EstimoteSDK(ESTBluetoothServiceOta.o)
      objc-class-ref in EstimoteSDK(ESTBluetoothServiceSoftware.o)
      objc-class-ref in EstimoteSDK(ETBluetoothMath.o)
  "_kSecAttrAccessibleWhenUnlocked", referenced from:
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
  "_kSecReturnAttributes", referenced from:
      +[ESTKeychain bundleSeedID] in EstimoteSDK(ESTKeychain.o)
  "_kSecAttrAccessible", referenced from:
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
  "_kSecAttrAccessibleAlways", referenced from:
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
  "_CBCentralManagerScanOptionAllowDuplicatesKey", referenced from:
      -[ESTBeaconDevice startScanning] in EstimoteSDK(ESTBeaconDevice.o)
  "_SecItemDelete", referenced from:
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
  "_kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly", referenced from:
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
  "_kSecAttrAccessibleAlwaysThisDeviceOnly", referenced from:
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
  "_SecItemUpdate", referenced from:
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
  "_kSecAttrAccessibleWhenUnlockedThisDeviceOnly", referenced from:
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
  "_SecItemAdd", referenced from:
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
      +[ESTKeychain bundleSeedID] in EstimoteSDK(ESTKeychain.o)
  "_SecItemCopyMatching", referenced from:
      -[ESTKeychain dataForKey:] in EstimoteSDK(ESTKeychain.o)
      +[ESTKeychain bundleSeedID] in EstimoteSDK(ESTKeychain.o)
  "_kSecClass", referenced from:
      -[ESTKeychain dataForKey:] in EstimoteSDK(ESTKeychain.o)
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
      +[ESTKeychain bundleSeedID] in EstimoteSDK(ESTKeychain.o)
  "_kSecClassGenericPassword", referenced from:
      -[ESTKeychain dataForKey:] in EstimoteSDK(ESTKeychain.o)
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
      +[ESTKeychain bundleSeedID] in EstimoteSDK(ESTKeychain.o)
  "_kSecAttrAccount", referenced from:
      -[ESTKeychain dataForKey:] in EstimoteSDK(ESTKeychain.o)
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
      +[ESTKeychain bundleSeedID] in EstimoteSDK(ESTKeychain.o)
  "_kSecValueData", referenced from:
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
  "_kSecAttrAccessGroup", referenced from:
      -[ESTKeychain dataForKey:] in EstimoteSDK(ESTKeychain.o)
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
      +[ESTKeychain bundleSeedID] in EstimoteSDK(ESTKeychain.o)
  "_kSecMatchLimitOne", referenced from:
      -[ESTKeychain dataForKey:] in EstimoteSDK(ESTKeychain.o)
  "_kSecMatchLimit", referenced from:
      -[ESTKeychain dataForKey:] in EstimoteSDK(ESTKeychain.o)
  "_kSecReturnData", referenced from:
      -[ESTKeychain dataForKey:] in EstimoteSDK(ESTKeychain.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

[编辑 3:] 添加 Security.framework 似乎又迈出了一步:

Ld /Users/.../Products/Debug-iphoneos/iDomsPortalDev.app/iDomsPortalDev normal arm64
    cd "/Users/.../idoms-portal"
    export IPHONEOS_DEPLOYMENT_TARGET=7.0
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.2.sdk -L/Users/.../Products/Debug-iphoneos -F/Users/.../Library/Frameworks -filelist /Users/.../iDoms.build/Debug-iphoneos/iDoms\ Dev.build/Objects-normal/arm64/iDomsPortalDev.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -lxml2 -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=7.0 -framework Security -framework CrashReporter -framework EstimoteSDK -weak_framework Accelerate -weak_framework Social -weak_framework Twitter -framework MessageUI -framework MapKit -framework AVFoundation -framework SystemConfiguration -framework MediaPlayer -framework QuartzCore -framework UIKit -framework Foundation -framework CoreGraphics -framework CoreData -framework CoreLocation -Xlinker -dependency_info -Xlinker /Users/Luuk/Library/Developer/Xcode/DerivedData/iDoms-gperwbbtttggqpcvozenraexrhrx/Build/Intermediates/iDoms.build/Debug-iphoneos/iDoms\ Dev.build/Objects-normal/arm64/iDomsPortalDev_dependency_info.dat -o /Users/Luuk/Library/Developer/Xcode/DerivedData/iDoms-gperwbbtttggqpcvozenraexrhrx/Build/Products/Debug-iphoneos/iDomsPortalDev.app/iDomsPortalDev

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_CBCentralManager", referenced from:
      objc-class-ref in EstimoteSDK(ESTBeaconDevice.o)
  "_OBJC_CLASS_$_CBUUID", referenced from:
      objc-class-ref in EstimoteSDK(ESTBeaconDevice.o)
      objc-class-ref in EstimoteSDK(ESTBluetoothServiceAuth.o)
      objc-class-ref in EstimoteSDK(ESTBluetoothServiceEstimote.o)
      objc-class-ref in EstimoteSDK(ESTBluetoothServiceOta.o)
      objc-class-ref in EstimoteSDK(ESTBluetoothServiceSoftware.o)
      objc-class-ref in EstimoteSDK(ETBluetoothMath.o)
  "_CBAdvertisementDataServiceDataKey", referenced from:
      +[ESTDeviceDataHelper parseAdvertisingData:] in EstimoteSDK(ESTDeviceDataHelper.o)
  "_CBCentralManagerScanOptionAllowDuplicatesKey", referenced from:
      -[ESTBeaconDevice startScanning] in EstimoteSDK(ESTBeaconDevice.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我刚下载 https://github.com/Estimote/iOS-SDK 他们的 SDK 并成功将其包含在示例项目中。

在“Build Settings”下的“Build Active Architecture Only”设置 'Debug' 到 YES

也试试 在 'General' 个选项卡中

  • 在'Link Frameworks and Libraries'下添加框架。
  • 在'Embedded Binaries'下添加框架。

确保 EstimoteSDK.framework 确实存在于其原始位置,您可能不小心删除了它。

查看 podspec,它指定要添加到 OTHER_LDFLAGS-lc++ 标志。如果您没有设置此标志,可能会导致此类问题。

感谢上面的各种提示,我检查了整个构建文件,并找到了不同的标志。它是 'Enable Modules',并在我的构建设置中设置为 'No'。

此问题已在 Estimote SDK 3.0.2 中修复! (:

https://github.com/Estimote/iOS-SDK/blob/master/CHANGELOG.md#302-march-26-2015