代码之家  ›  专栏  ›  技术社区  ›  Luuk D. Jansen

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

  •  0
  • Luuk D. Jansen  · 技术社区  · 10 年前

    我正在尝试将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)
    

    我已将框架添加到“构建阶段”,并检查框架搜索目录设置是否包含该目录。

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

    我怎样才能弄清楚出了什么问题?

    编辑: 我正在使用Xcode 6.2。 我正在为iPhone 6构建(如arm64、armv7和armv7s架构)。在下面的问题之后,我为armv7构建,并且我得到了相同的错误(针对armv7)。因此,连接框架肯定存在问题。

    编辑2:我删除了-ObjC“其他链接器标志”,因为将其添加到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)
    
    4 回复  |  直到 10 年前
        1
  •  1
  •   Luuk D. Jansen    10 年前

    由于上面的各种提示,我浏览了整个构建文件,发现了不同的标志。它是“启用模块”,在我的构建设置中设置为“否”。

        2
  •  0
  •   heypiotr    10 年前
        3
  •  0
  •   swapnilagarwal    10 年前

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

    低于' 生成设置 “在” 仅构建活动体系结构 '集合 ' 调试 '至

    也试试看 在“常规”选项卡中

    • 在“链接框架和库”下添加框架。
    • 在“嵌入式二进制文件”下添加框架。

    确保EstimoteSDK.framework实际位于其原始位置,您可能无意中删除了它。

        4
  •  0
  •   MANIAK_dobrii    10 年前

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