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

Unity项目适配Xcode13编译报错:Undefined symbol问题求助

Unity iOS编译报错:大量Undefined symbol: _objc_msgSend$xxx问题解决

问题背景

Unity开发的游戏已在Google Play上线,Android端Admob广告、内购功能正常。尝试发布到App Store时,因旧Mac仅支持Xcode 13.0,编译iOS项目时出现大量Undefined symbol: _objc_msgSend$xxx类错误(完整错误列表见下方)。

完整错误列表

Undefined symbol: _objc_msgSend$initWithURL:resolvingAgainstBaseURL:
Undefined symbol: _objc_msgSend$queryItems
Undefined symbol: _objc_msgSend$initWithBytes:length:
Undefined symbol: _objc_msgSend$initMessageInfoFn
Undefined symbol: _objc_msgSend$copyMessageInfoFn
Undefined symbol: _objc_msgSend$showWithCompletionHandler:
Undefined symbol: _objc_msgSend$initWithConsentFormClientReference:
Undefined symbol: _objc_msgSend$isConsentFormAvailable
Undefined symbol: _objc_msgSend$initWithConsentInformationClientReference:
Undefined symbol: _objc_msgSend$adSourceInstanceName
Undefined symbol: _objc_msgSend$adSourceName
Undefined symbol: _objc_msgSend$extrasDictionary
Undefined symbol: _objc_msgSend$responseIdentifier
Undefined symbol: _objc_msgSend$adNetworkClassName
Undefined symbol: _objc_msgSend$loadWithAdUnitID:orientation:request:
Undefined symbol: _objc_msgSend$setCustomAdPosition:
Undefined symbol: _objc_msgSend$setAdPosition:
Undefined symbol: _objc_msgSend$setExtraWithKey:value:
Undefined symbol: _objc_msgSend$adNetworkExtrasWithDictionary:
Undefined symbol: _objc_msgSend$setCustomRewardString:
Undefined symbol: _objc_msgSend$setUserIdentifier:
Undefined symbol: _objc_msgSend$addKeyword:
Undefined symbol: _objc_msgSend$maxAdContentRating
Undefined symbol: _objc_msgSend$setMaxAdContentRating:
Undefined symbol: _objc_msgSend$tagForUnderAgeOfConsent:
Undefined symbol: _objc_msgSend$tagForChildDirectedTreatment:
Undefined symbol: _objc_msgSend$sameAppKeyEnabled
Undefined symbol: _objc_msgSend$setSameAppKeyEnabled:
Undefined symbol: _objc_msgSend$heightInPixels
Undefined symbol: _objc_msgSend$setDidEarnRewardCallback:
Undefined symbol: _objc_msgSend$setAdFailedCallback:
Undefined symbol: _objc_msgSend$setDidDismissCallback:
Undefined symbol: _objc_msgSend$setAdImpressionCallback:
Undefined symbol: _objc_msgSend$show
Undefined symbol: _objc_msgSend$setAdClickedCallback:
Undefined symbol: _objc_msgSend$setAdLoadedCallback:
Undefined symbol: _objc_msgSend$setAdFailedToLoadCallback:
Undefined symbol: _objc_msgSend$setPaidEventCallback:
Undefined symbol: _objc_msgSend$setAdFailedToPresentFullScreenContentCallback:
Undefined symbol: _objc_msgSend$setAdWillPresentFullScreenContentCallback:
Undefined symbol: _objc_msgSend$initWithRewardedInterstitialAdClientReference:
Undefined symbol: _objc_msgSend$initWithSmartBannerSizeAndBannerClientReference:adUnitID:adPosition:
Undefined symbol: _objc_msgSend$initWithBannerClientReference:adUnitID:width:height:adPosition:
Undefined symbol: _objc_msgSend$initWithAppOpenAdClientReference:
Undefined symbol: _objc_msgSend$setPauseOnBackground:
Undefined symbol: _objc_msgSend$setApplicationMuted:
Undefined symbol: _objc_msgSend$state
Undefined symbol: _objc_msgSend$gadu_referenceKey
Undefined symbol: _objc_msgSend$startWithCompletionHandler:
Undefined symbol: _objc_msgSend$environment
Undefined symbol: _objc_msgSend$indexOfObject:
Undefined symbol: _objc_msgSend$price
Undefined symbol: _objc_msgSend$priceLocale
Undefined symbol: _objc_msgSend$transactionID
Undefined symbol: _objc_msgSend$originalTransactionID
Undefined symbol: _objc_msgSend$isIntroductoryOffer
Undefined symbol: _objc_msgSend$setDateFormat:
Undefined symbol: _objc_msgSend$timeZoneForSecondsFromGMT:
Undefined symbol: _objc_msgSend$dateFromString:
Undefined symbol: _objc_msgSend$compare:options:
Undefined symbol: _objc_msgSend$dictionaryWithObjects:forKeys:
Undefined symbol: _objc_msgSend$moveItemAtPath:toPath:error:
Undefined symbol: _objc_msgSend$pathExtension
Undefined symbol: _objc_msgSend$stringByAppendingPathExtension:
Undefined symbol: _objc_msgSend$initFileURLWithPath:
Undefined symbol: _objc_msgSend$maxParametersPerFilter
Undefined symbol: _objc_msgSend$maxFiltersPerAudience
Undefined symbol: _objc_msgSend$dateWithTimeIntervalSince1970:
Undefined symbol: _objc_msgSend$timeIntervalSinceDate:
Undefined symbol: _objc_msgSend$adapterStatusesByClassName
Undefined symbol: _objc_msgSend$compare:options:range:locale:
Undefined symbol: _objc_msgSend$isValidInternalEventParameterName:failureCode:
Undefined symbol: _objc_msgSend$sortedArrayUsingComparator:
Undefined symbol: _objc_msgSend$itemScopedCustomParameterEnabled
Undefined symbol: _objc_msgSend$maxItemScopedCustomParameters
Undefined symbol: _objc_msgSend$isValidArrayParamItem:failureCode:
Undefined symbol: _objc_msgSend$setCenter:
Undefined symbol: _objc_msgSend$safeAreaLayoutGuide
Undefined symbol: _objc_msgSend$layoutFrame
Undefined symbol: _objc_msgSend$isOperatingSystemAtLeastVersion:
Undefined symbol: _objc_msgSend$setAppOpenAd:
Undefined symbol: _objc_msgSend$appOpenAd
Undefined symbol: _objc_msgSend$loadWithAdUnitID:request:orientation:completionHandler:
Undefined symbol: _objc_msgSend$setRewardedInterstitialAd:
Undefined symbol: _objc_msgSend$rewardedInterstitialAd
Undefined symbol: _objc_msgSend$rewardedInterstitialAdClient
Undefined symbol: _objc_msgSend$setAdditionalParameters:
Undefined symbol: _objc_msgSend$interstitialClient
Undefined symbol: _objc_msgSend$adDidDismissFullScreenContentCallback
Undefined symbol: _objc_msgSend$pauseOnBackground
Undefined symbol: _objc_msgSend$adWillPresentFullScreenContentCallback
Undefined symbol: _objc_msgSend$adFailedToPresentFullScreenContentCallback
Undefined symbol: _objc_msgSend$adReward
Undefined symbol: _objc_msgSend$rewardedAd
Undefined symbol: _objc_msgSend$presentFromRootViewController:userDidEarnRewardHandler:
Undefined symbol: _objc_msgSend$setFullScreenContentDelegate:
Undefined symbol: _objc_msgSend$adLoadedCallback
Undefined symbol: _objc_msgSend$setTagForChildDirectedTreatment:
Undefined symbol: _objc_msgSend$rewardedAdClient
Undefined symbol: _objc_msgSend$adImpressionCallback

解决方案

1. 降级适配Xcode 13的第三方插件版本

这些错误大多来自Admob、Unity IAP等插件的SDK与Xcode 13不兼容。新版本的Google Mobile Ads SDK已不再支持Xcode 13,需降级到适配版本:

  • Google Mobile Ads Unity Plugin:选择8.3.0及以下版本(该版本适配Xcode 13及iOS 15)
  • Unity IAP:选择4.4.0及以下版本,确保与Xcode 13的iOS SDK兼容

2. 调整Unity iOS构建配置

  • 在Unity编辑器的Player Settings > iOS > Other Settings中,设置Target iOS Version为15.0(Xcode 13支持的最高iOS版本)
  • 关闭Bitcode选项(部分新版本SDK默认不支持Bitcode,Xcode 13处理高版本SDK的Bitcode会引发符号缺失)

3. 修复Xcode项目链接设置

  • 打开生成的Xcode项目,进入Build Settings,找到Other Linker Flags,添加-ObjC参数(确保静态库中的Objective-C类别和符号被正确链接)
  • 确认项目已添加必要的系统框架:StoreKit、AdSupport、CoreTelephony、SystemConfiguration(Admob和内购功能依赖这些框架)

4. 清理缓存并重新构建

  • 删除Unity项目根目录下的Library文件夹,重新生成iOS项目(清除旧的缓存文件,避免插件版本冲突)
  • 在Xcode中执行Cmd+Shift+K清理Build Folder,再重新编译项目

5. 检查插件的iOS依赖配置

  • 在Unity的Package Manager中,确认Admob和IAP插件的iOS依赖已正确导入,没有重复或缺失的库文件
  • 打开Xcode项目的Frameworks, Libraries, and Embedded Content面板,确保所有插件的.framework文件都设置为Embed & Sign

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.21 12:07:06