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

Unity项目升级FB SDK 14.1.0后iOS端Facebook登录崩溃问题

Unity 升级FB SDK 14.1.0后iOS登录问题解决方法

问题场景

使用Unity 2019.4.15f1版本,升级Facebook SDK至14.1.0后,iOS端点击Facebook登录按钮时应用冻结并崩溃,日志抛出如下异常:

Sep 21 15:29:21 iPhone MyProject(UnityFramework)[15154] <Notice>: Uncaught exception: 

InvalidOperationException: fb0 is not registered as a URL scheme. Please add it in your Info.plist
(
   0   CoreFoundation                      0x000000019076529c 6B22DD81-3585-3BE6-BC77-BA19810EC0F2 + 627356
   1   libobjc.A.dylib                     0x00000001a9495744 objc_exception_throw + 60
   2   FBSDKCoreKit                        0x00000001056dd3bc -[FBSDKInternalUtility validateFacebookReservedURLSchemes] + 0
   3   FBSDKLoginKit                       0x0000000105a99624 $s13FBSDKLoginKit12LoginManagerC15logInParameters13configuration12loggingToken20authenticationMethodSDyS2SGSgAA0C13ConfigurationCSg_SSSgSStF + 372
   4   FBSDKLoginKit                       0x0000000105a97544 $s13FBSDKLoginKit12LoginManagerC19performBrowserLogIn33_C218275A97333B874EDDFE627110566CLL7handleryySb_s5Error_pSgtcSg_tF + 1216
   5   FBSDKLoginKit                       0x0000000105aa1b00 $s13FBSDKLoginKit12LoginManagerC5logIn33_C218275A97333B874EDDFE627110566CLL11permissions7handleryShyAA12FBPermissionCG_yAA0cdC6Resul

当前Info.plist配置

CFBundleURLTypes配置

<key>CFBundleURLTypes</key>
<array>
   <dict>
      <key>CFBundleURLSchemes</key>
      <array>
         <string>fb***************</string>
      </array>
   </dict>
</array>

LSApplicationQueriesSchemes配置

<key>LSApplicationQueriesSchemes</key>
    <array>
      <string>fbapi</string>
      <string>fbapi20130214</string>
      <string>fbapi20130410</string>
      <string>fbapi20130702</string>
      <string>fbapi20131010</string>
      <string>fbapi20131219</string>
      <string>fbapi20140410</string>
      <string>fbapi20140116</string>
      <string>fbapi20150313</string>
      <string>fbapi20150629</string>
      <string>fbapi20160328</string>
      <string>fbauth</string>
      <string>fbauth2</string>
      <string>fb-messenger-api20140430</string>
    </array>

中间尝试与新问题

在CFBundleURLSchemes中手动添加fb0后,应用不再崩溃,但Facebook登录页面显示**"Sorry, something went wrong"**。

最终解决方法

排查发现升级FB SDK后FacebookSettings.asset文件损坏,所有应用ID丢失,按以下步骤修复:

  • 重新复制FacebookSettings.asset文件到项目对应目录
  • 在Unity的Facebook设置面板中重新添加应用ID
  • 移除CFBundleURLSchemes中手动添加的fb0条目(该条目为FB SDK默认自带,无需手动配置)

完成以上操作后,iOS端Facebook登录功能恢复正常。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.18 14:50:34