You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

升级iOS MLKit/Translate至7.0.0后出现大量链接未定义符号问题

iOS MLKit 7.0.0 升级后链接失败(未定义符号)

我有一款已发布的iOS应用,使用MLKit/Translate组件,在iOS 17.5系统下运行正常。将Pod升级至MLKit 7.0.0并将目标版本设为iOS 15.5后,Pod链接失败,出现20余个未定义符号。Podfile.lock显示所有Pod均为最新版本,包括GoogleDataTransport、MLKitCore、MLKitCommon等。

具体错误信息

_GULOSLogBasic", referenced from:
      _MLKLog in MLKitCommon[x86_64][7](MLKLogger.o)
  "_GULOSLogError", referenced from:
      -[GULCCComponentContainer populateComponentsFromRegisteredClasses:withContext:] in MLKitCommon[x86_64][212](GULCCComponentContainer.o)
      -[GULCCComponentContainer instantiateInstanceForProtocol:withBlock:] in MLKitCommon[x86_64][212](GULCCComponentContainer.o)
  "_OBJC_CLASS_$_GDTCORTransport", referenced from:
       in MLKitCommon[x86_64][6](MLKFirelogTransport.o)
  "_OBJC_CLASS_$_GTMLogMininumLevelFilter", referenced from:
       in MLKitCommon[x86_64][200](GIPLoggingReroutingGTMLogger.o)
  "_OBJC_CLASS_$_GTMLogger", referenced from:
       in MLKitCommon[x86_64][26](CCTClearcutUploader.o)
      _OBJC_CLASS_$_MLKITx_GIPLoggingReroutingGTMLogger in MLKitCommon[x86_64][200](GIPLoggingReroutingGTMLogger.o)
  "_OBJC_CLASS_$_GTMSessionCookieStorage", referenced from:
       in MLKitCommon[x86_64][26](CCTClearcutUploader.o)
  "_OBJC_CLASS_$_GTMSessionFetcher", referenced from:
       in MLKitCommon[x86_64][26](CCTClearcutUploader.o)
  "_OBJC_CLASS_$_GTMSessionFetcherService", referenced from:
       in MLKitCommon[x86_64][18](MLKModelDownloader.o)
  "_OBJC_CLASS_$_GTMStringEncoding", referenced from:
       in MLKitNaturalLanguage[x86_64][8](MLKFirebaseInstallationId.o)
  "_OBJC_CLASS_$_GULAppEnvironmentUtil", referenced from:
       in MLKitNaturalLanguage[x86_64][7](MLKDevice.o)
  "_OBJC_CLASS_$_GULUserDefaults", referenced from:
       in MLKitCommon[x86_64][2](MLKAnalyticsLogger.o)
  "_OBJC_CLASS_$_SSZipArchive", referenced from:
       in MLKitTranslate
  "_OBJC_METACLASS_$_GTMLogger", referenced from:
      _OBJC_METACLASS_$_MLKITx_GIPLoggingReroutingGTMLogger in MLKitCommon[x86_64][200](GIPLoggingReroutingGTMLogger.o)
  "_kGTMSessionFetcherStatusDomain", referenced from:
      ___69-[MLKModelDownloader beginModelDownloadWithURL:modelInfo:conditions:]_block_invoke.283 in MLKitCommon[x86_64][18](MLKModelManager.o)
      ___150-[MLKITx_PHTHeterodyneSyncer batchSyncWithAccounts:syncedScopes:fetchReason:throttlingCache:heterodyneSyncInfo:accountToAuthToken:lastError:callback:]_block_invoke in MLKitCommon[x86_64][48](PHTHeterodyneSyncer.o)
      ___91-[MLKITx_PHTInternalHeterodyneSyncer syncHoldingLockWithSyncedScopes:fetchReason:callback:]_block_invoke in MLKitCommon[x86_64][51](PHTInternalHeterodyneSyncer.o)
  "_unzClose", referenced from:
      -[MLKModelManager(Translate) downloadedTranslateModels] in MLKitTranslate
  "_unzCloseCurrentFile", referenced from:
      -[MLKModelManager(Translate) downloadedTranslateModels] in MLKitTranslate
  "_unzGetCurrentFileInfo", referenced from:
      -[MLKModelManager(Translate) downloadedTranslateModels] in MLKitTranslate
  "_unzGoToNextFile", referenced from:
      -[MLKModelManager(Translate) downloadedTranslateModels] in MLKitTranslate
  "_unzOpen", referenced from:
      -[MLKModelManager(Translate) downloadedTranslateModels] in MLKitTranslate
  "_unzOpenCurrentFile", referenced from:
      -[MLKModelManager(Translate) downloadedTranslateModels] in MLKitTranslate
  "_unzReadCurrentFile", referenced from:
      -[MLKModelManager(Translate) downloadedTranslateModels] in MLKitTranslate

解决建议

  • 清理CocoaPods缓存并重新安装:
    依次执行以下命令:
    pod deintegrate
    rm -rf Podfile.lock
    rm -rf ~/Library/Caches/CocoaPods
    rm -rf ~/Library/Developer/Xcode/DerivedData
    pod install
    
  • 显式添加缺失的依赖库:
    从错误信息来看,项目缺失GTMSessionFetcher、GoogleUtilities、SSZipArchive等依赖,在Podfile中添加以下声明后重新执行pod install:
    pod 'GTMSessionFetcher'
    pod 'GoogleUtilities'
    pod 'SSZipArchive'
    
  • 验证版本兼容性:
    临时将iOS目标版本改回17.5,确认是否是版本适配问题;若必须使用iOS 15.5,查看MLKit官方文档确认版本支持范围,考虑降级到兼容iOS 15.5的MLKit版本
  • 检查Xcode链接设置:
    进入项目Build Settings,找到Other Linker Flags,确保包含-ObjC或-all_load(部分静态库需要此配置才能正确链接)
  • 确认Pod架构支持:
    执行pod repo update更新本地Pod仓库后重新安装,确保下载的Pod包含x86_64架构支持

内容的提问来源于stack exchange,提问作者BlueskyMed

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 21:35:11