当我在Xcode上构建我的原生脚本应用程序时收到一个错误,因为升级到Xcode 13
./.build_env_vars.sh: line 454: declare: UID: readonly variable
NSLD: Swift bridging header '*-Swift.h' not found under '/Users/gaetan.delsaux/Library/Developer/Xcode/DerivedData/mbwsinventoryapp-egjrwafdujqbnuemdmqazirgunfd/Build/Intermediates.noindex/mbwsinventoryapp.build/Debug-iphonesimulator/mbwsinventoryapp.build/Objects-normal/x86_64'
Generating metadata...~/PhpstormProjects/mbws-inventory-app/platforms/ios/internal/metadata-generator/bin ~/PhpstormProjects/mbws-inventory-app/platforms/ios
Python version: 2.7.18 (v2.7.18:8d21aa21f2, Apr 19 2020, 20:48:48)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]
Traceback (most recent call last):
File "./build-step-metadata-generator.py", line 41, in <module>
deployment_target_flag_name = env("DEPLOYMENT_TARGET_CLANG_FLAG_NAME")
File "./build-step-metadata-generator.py", line 14, in env
return os.environ[env_name]
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py", line 40, in __getitem__
raise KeyError(key)
KeyError: 'DEPLOYMENT_TARGET_CLANG_FLAG_NAME'
Command Ld failed with a nonzero exit code
我四处看了看,但我发现答案都与Objective c有关。
有人面对这个问题并找到解决方案吗?
解决方案是将NativeScript升级到6.5.5或更高版本,其中包含一个补丁。
如果您对技术细节感兴趣,或者来自其他项目,请继续阅读。
在Xcode 13.3及以上版本中,环境变量DEPLOYMENT_TARGET_CLANG_NAME
和DEPLOYMENT_TARGET_CLANG_ENV_NAME
不再存在。
您可以通过使用EFFECTIVE_PLATFORM_NAME
:
platform = env("EFFECTIVE_PLATFORM_NAME")
if platform is "-iphoneos":
flag = "-miphoneos-version-min"
target = "IPHONEOS_DEPLOYMENT_TARGET"
elif platform is "-iphonesimulator":
flag = "-mios-simulator-version-min"
target = "IPHONEOS_DEPLOYMENT_TARGET"
elif platform is "-watchos"
flag = "-mwatchos-version-min"
target = "WATCHOS_DEPLOYMENT_TARGET"
elif platform is "-watchossimulator"
flag = "-mwatchos-simulator-version-min"
target = "WATCHOS_DEPLOYMENT_TARGET"
elif platform is "-appletvos"
flag = "-mappletvos-version-min"
target = "APPLETVOS_DEPLOYMENT_TARGET"
elif platform is "-appletvsimulator":
flag = "-mappletvsimulator-version-min"
target = "APPLETVOS_DEPLOYMENT_TARGET"
else:
flag = "-mmacosx-version-min"
target = "MACOSX_DEPLOYMENT_TARGET"
感谢https://github.com/NativeScript/ios-jsc/pull/1296的作者演示了该技术。