我正在开发一个 Google Cardboard 应用程序并在 iOS 中构建得很好。但是将 Soomla 添加到项目中会导致链接器错误:
Ld /Users/foundway/Library/Developer/Xcode/DerivedData/Unity-iPhone-grxtfxrygreysieuyeovxlhlmgxu/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/RealiteerCore normal armv7
cd /Users/foundway/GitHub/RealiteerCore/Build/RealiteerCoreIOS
export IPHONEOS_DEPLOYMENT_TARGET=6.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 armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk -L/Users/foundway/Library/Developer/Xcode/DerivedData/Unity-iPhone-grxtfxrygreysieuyeovxlhlmgxu/Build/Products/Release-iphoneos -L/Users/foundway/GitHub/RealiteerCore/Build/RealiteerCoreIOS -L/Users/foundway/GitHub/RealiteerCore/Build/RealiteerCoreIOS/Libraries -L/Applications/Unity/Unity.app/Contents/PlaybackEngines/iOSSupport/Trampoline/Libraries -L/Users/foundway/GitHub/RealiteerCore/Assets/Plugins/iOS -F/Users/foundway/Library/Developer/Xcode/DerivedData/Unity-iPhone-grxtfxrygreysieuyeovxlhlmgxu/Build/Products/Release-iphoneos -filelist /Users/foundway/Library/Developer/Xcode/DerivedData/Unity-iPhone-grxtfxrygreysieuyeovxlhlmgxu/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/RealiteerCore.LinkFileList -Xlinker -map -Xlinker /Users/foundway/Library/Developer/Xcode/DerivedData/Unity-iPhone-grxtfxrygreysieuyeovxlhlmgxu/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/RealiteerCore-LinkMap-normal-armv7.txt -dead_strip -lc++ -weak_framework CoreMotion -weak-lSystem -ObjC -stdlib=libc++ -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=6.0 -framework Security -framework CoreText -framework Foundation -framework UIKit -framework OpenGLES -framework QuartzCore -framework OpenAL -liconv.2 -framework AudioToolbox -framework CFNetwork -framework MediaPlayer -framework CoreLocation -framework SystemConfiguration -weak_framework iAd -framework CoreMedia -framework CoreVideo -weak_framework AVFoundation -framework CoreGraphics -weak_framework CoreMotion -liPhone-lib-il2cpp -liontext -lVuforia -lcardboard -lionimagecompression -lionimage -lremote_assets -lport -levent_internal -lQuantumCore -lbase -lNimbusCore -lrecorder -liongfx -lprotos_lib -lsoftware -lionwebp -lcardboard_protos -lionportgfx -lionstblib -lGoogleKitHUD -lionmath -lionlodepnglib -liongfxutils -lsensors -ltype -lapi -lprotobuf -lionfreetype2 -lionremote -lNimbusAttributedLabel -llogging -lProtocolBuffers -lUnityiOSProfile -lplatform -lSoomlaIOSCore -lvr -lionport -lcomposite -ldatatypes -ldevice -lNimbusModels -levent -lionanalytics -lgflags -lQCARUnityPlayer -lionbase -lionjsoncpp -lionzlib -ldevice_internal -lionmongoose -lGoogleKitCore -lionopenctm -lvrunity -lSoomlaiOSProfile -lUnitySoomlaiOSCore -llogging_protos -lionprofile -lsqlite3.0 -Xlinker -dependency_info -Xlinker /Users/foundway/Library/Developer/Xcode/DerivedData/Unity-iPhone-grxtfxrygreysieuyeovxlhlmgxu/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/RealiteerCore_dependency_info.dat -o /Users/foundway/Library/Developer/Xcode/DerivedData/Unity-iPhone-grxtfxrygreysieuyeovxlhlmgxu/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/RealiteerCore
Undefined symbols for architecture armv7:
"gvr::CreateMainApp__EXPECTED_EXACTLY_ONE_VR_MAIN_APP_STATEMENT__(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&)", referenced from:
l001 in libplatform.a(vr_ios.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我刚刚将 Soomla 添加到我的 Cardboard 应用程序中,但看起来 Soomla 和 Google Cardboard 正在争夺主应用程序(libplatform.a 来自 Google Cardboard)。我认为 Google Cardboard 需要成为主要应用程序。
所以,我想知道是否有办法让其他插件不争夺主应用程序?
它也可以是别的东西... 以上只是我的理论。
最佳答案
这是因为 Xcode 构建标志 -ObjC,它改变了 .a 文件的链接方式。 Cardboard .a 文件中有一些 Cardboard SDK 本身不需要(或不需要)的代码(例如,CreateMainApp)。
您可以通过从 Xcode 中的链接标志中删除 -ObjC 标志来解决此问题。注意:这可能会导致 Soomla 无法链接,但希望他们只是“以防万一”包含它。所以先试试这个,如果仍然失败,请在这里发表评论。