0

我已将 BurstlySDK 和 TestFlightSDK 添加到我的项目中,但出现以下链接器错误:

duplicate symbol _OBJC_CLASS_$_TFApplicationInformation in:
/Users/Andrey/Documents/Helicopter/helicopter_clone/HelicopterClone/BurstlySDK/libBurstly.a(TFApplicationInformation.o)
/Users/Andrey/Documents/Helicopter/helicopter_clone/HelicopterClone/TestFlightSDK2/libTestFlight.a(TFApplicationInformation.o)

引用TFApplicationInformation的只是一个例子。错误消息中提到了大约十个带有 TF 前缀的类。任何人都可以解释为什么会这样吗?谢谢

4

3 回答 3

2

由于 TestFlight SDK 与 SkyRocket SDK 捆绑在一起,因此您无需在 libTestFlight.a 中进行链接,但您需要将 TestFlight.h 保留在您的项目中,并在需要使用 TestFlight 功能时将该标头导入到类中。如果您没有 TestFlight.h(它应该与 TestFlight SDK 完全捆绑在一起),您可以在此处下载 TestFlight SDK:https ://testflightapp.com/sdk/download/

于 2013-09-24T17:09:51.523 回答
1

来自 Burslty iOS 集成指南:

Note: The TestFlight SDK has been bundled with SkyRocket since 2.X

http://quickstart.burstly.com/ios-release-notes

于 2013-09-24T11:40:27.477 回答
1

正如上面 Alex M 所建议的那样,Burstly 支持建议删除 libTestFlight.a,但这让我感到紧张,因为我感觉到 Burstly 将更多资源用于维护 TestFlight SDK 而不是 SkyRocket SDK。诚然,这种直觉可能是我的想象,但我无法摆脱它。

所以,我写了这个脚本。它从 libBurstly.a 中去除重复的符号并输出一个 libBurstly-noTestFlight.a,它可以无冲突地链接。对于我当前的项目,路径是硬编码的,所以如果你想使用它,你必须为你自己的项目调整脚本。

#!/bin/bash

# I install this script as $(SRCROOT)/scripts/strip_tf_duplicate_symbols, and 
# run it from $(SRCROOT).  
# It looks for libBurstly.a under $(SRCROOT)/Vendors/BurstlySDK.
# Sorry about the hard-coded paths.  I didn't design this to be used in other projects.

if [ -d ./Vendors/BurstlySDK ]
then
    echo "Preparing to strip duplicate symbols from libBurstly.a..."
else
    echo "Creates Vendors/BurstlySDK/libBurstly-noTestFlight.a with duplicate symbols removed."
    echo "Usage: run ./scripts/strip_tf_duplicate_symbols from the Xcode project root"
    exit
fi

cd Vendors/BurstlySDK

echo "Breaking fat libBurstly.a into separate armv7 and i386 libraries..."
xcrun -sdk iphoneos lipo -thin armv7 libBurstly.a -output libBurstly-armv7.a
xcrun -sdk iphoneos lipo -thin armv7s libBurstly.a -output libBurstly-armv7s.a
xcrun -sdk iphoneos lipo -thin i386 libBurstly.a -output libBurstly-i386.a

echo "Extracting .o files into architecture-specific subdirectories..."
mkdir -p libBurstly-armv7 libBurstly-armv7s libBurstly-i386
cd libBurstly-i386
ar -x ../libBurstly-i386.a
cd ..
cd libBurstly-armv7
ar -x ../libBurstly-armv7.a
cd ..
cd libBurstly-armv7s
ar -x ../libBurstly-armv7s.a
cd ..

echo "Removing .o files with duplicate symbols..."
rm  */TF_OpenUDID.o
rm  */TFMessagePack.o
rm  */TestFlight.o
rm  */TFReachability.o
rm */TFNetworkManager.o
rm */TFMemoryMonitor.o
rm */TFDeviceInfo.o
rm */TFCrypto.o
rm */TFApplicationInformation.o


echo "Repacking architecture-specific .a files..."
cd libBurstly-i386
xcrun -sdk iphoneos libtool -static -o ../libBurstly-i386.a *.o 
cd ..
cd libBurstly-armv7
xcrun -sdk iphoneos libtool -static -o ../libBurstly-armv7.a *.o 
cd ..
cd libBurstly-armv7s
xcrun -sdk iphoneos libtool -static -o ../libBurstly-armv7s.a *.o 
cd ..

echo "Recombining thin files into libBurstly-noTestFlight.a"
xcrun -sdk iphoneos lipo -create libBurstly-i386.a libBurstly-armv7.a libBurstly-armv7s.a -output libBurstly-noTestFlight.a

echo "Cleaning up..."
rm -rf libBurstly-armv7 libBurstly-armv7s libBurstly-i386

ls -1 libBurstly-noTestFlight.a
echo "Done"
于 2013-10-12T08:09:26.673 回答