我已将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前缀的类。 anybode可以解释它为什么会发生吗?感谢
答案 0 :(得分:2)
由于TestFlight SDK与SkyRocket SDK捆绑在一起,因此您无需在libTestFlight.a中进行链接,但您需要在项目中保留TestFlight.h,并在需要使用TestFlight功能时在类中导入该标头。如果您没有TestFlight.h(它应该与TestFlight SDK完全捆绑在一起),您可以在此处下载TestFlight SDK:https://testflightapp.com/sdk/download/
答案 1 :(得分:1)
来自Burslty iOS集成指南:
Note: The TestFlight SDK has been bundled with SkyRocket since 2.X
答案 2 :(得分:1)
Burstly支持建议删除libTestFlight.a,正如Alex M上面提到的那样,但这让我感到紧张,因为我觉得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"