- Library 'iconv.2.4.0' not found
- libiconv.2.4.0 被移除了, 使用 libiconv.2.tbd
- 工程中有 Assertion failed 會(huì)被成功的時(shí)候觸發(fā)斷言, 以及 MMKV 初始化報(bào)錯(cuò), 以及 duplicate symbols 報(bào)錯(cuò)
- 原因是: Binaries using symbols with a weak definition crash at runtime on iOS 14/macOS 12 or older. This impacts primarily C++ projects due to their extensive use of weak symbols.
- 解決辦法: Build Setting -> Other Linker Flag,新增一項(xiàng) -ld_classic
- NWProtocolTCP.Options() crash
- 修改工程最低版本為 12 或者 13
- 編譯報(bào)錯(cuò): error: Sandbox: rsync(5825) deny(1) file-write-create
- Build Setting -> User Script Sandboxing,新增一項(xiàng) NO
在 podfile 中添加這段代碼, 在 post_install 鉤子函數(shù)中調(diào)用 fixWeakCPlus_Xcode15, 可以在 debug 下修改上面的第二個(gè)第三個(gè)錯(cuò)誤
require 'xcodeproj'
def fixWeakCPlus_Xcode15(installer)
# 獲取當(dāng)前的 Xcode 版本
current_xcode_version = `xcodebuild -version`.scan(/\d+.\d+/).first.to_f
main_project = Xcodeproj::Project.open('Paperang.xcodeproj')
# 獲取主工程的主 target(一般是你的應(yīng)用程序的 target)
main_target = main_project.targets.first # 假設(shè)主 target 是主工程的第一個(gè) target
# 獲取主工程的 Build Settings
build_settings = main_target.build_settings('Debug') # 你可以根據(jù)需要獲取特定配置的 Build Settings
# 需要保存否
needSave = 0
# c++ weak 標(biāo)識(shí)
weak_flag = '-ld_classic'
# 根據(jù) Xcode 版本執(zhí)行不同的處理
if current_xcode_version >= 15.0
if main_target
needSave = 1
# 修改版本號(hào)(目的是適配 Starscream NWProtocolTCP.Options() 報(bào)錯(cuò))
build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
# 在這里使用 build_settings 來(lái)獲取和操作 Build Settings 的值
# 例如,獲取特定設(shè)置的值:
otherLink_setting_value = build_settings['OTHER_LDFLAGS']
if otherLink_setting_value.include?(weak_flag) == false
otherLink_setting_value.append(weak_flag)
puts "OTHER_LDFLAGS Build Setting Value: #{otherLink_setting_value}"
end
end
else
if current_xcode_version != 11.0
needSave = 1
# 獲取主工程的 Build Settings
build_settings = main_target.build_settings('Debug') # 你可以根據(jù)需要獲取特定配置的 Build Settings
# 修改版本號(hào)
build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
# 在這里使用 build_settings 來(lái)獲取和操作 Build Settings 的值
# 例如,獲取特定設(shè)置的值:
otherLink_setting_value = build_settings['OTHER_LDFLAGS']
if otherLink_setting_value.include?(weak_flag)
otherLink_setting_value.delete(weak_flag)
puts "OTHER_LDFLAGS Build Setting Value: #{otherLink_setting_value}"
end
end
end
if needSave
# 保存對(duì)主工程的任何修改(如果需要)
main_project.save
end
end