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

iOS设备Flutter第三方登录「Share Your Information」弹窗闪退求助

iOS端第三方登录授权弹窗闪退及Pod依赖报错解决方案

问题概述

  • Flutter应用集成web3auth_flutter第三方登录包,Android端运行正常
  • iOS端发布到Apple开发者账号并安装到iPhone后,Google/Facebook/Twitter登录时,「Share Your Information」授权弹窗仅显示1秒即消失,无法操作
  • 首次发布iOS应用,对苹果开发不熟悉

授权弹窗截图

Share Your Information授权弹窗

后续操作报错

按建议操作后出现CocoaPods兼容错误:

[!] CocoaPods could not find compatible versions for pod "web3auth_flutter":
In Podfile:
web3auth_flutter (from .symlinks/plugins/web3auth_flutter/ios)

Specs satisfying the web3auth_flutter (from .symlinks/plugins/web3auth_flutter/ios) dependency were found, but they required a higher minimum deployment target.


一、解决授权弹窗闪退问题

1. 检查ATS配置

苹果ATS默认限制非HTTPS请求,需在ios/Runner/Info.plist中添加第三方登录域名的例外:

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
  <false/>
  <key>NSExceptionDomains</key>
  <dict>
    <key>google.com</key>
    <dict>
      <key>NSIncludesSubdomains</key>
      <true/>
      <key>NSExceptionAllowsInsecureHTTPLoads</key>
      <false/>
    </dict>
    <key>facebook.com</key>
    <dict>
      <key>NSIncludesSubdomains</key>
      <true/>
      <key>NSExceptionAllowsInsecureHTTPLoads</key>
      <false/>
    </dict>
    <key>twitter.com</key>
    <dict>
      <key>NSIncludesSubdomains</key>
      <true/>
      <key>NSExceptionAllowsInsecureHTTPLoads</key>
      <false/>
    </dict>
  </dict>
</dict>

2. 验证URL Scheme配置

第三方登录需要配置对应的回调Scheme,在Info.plist的CFBundleURLTypes中添加:

<key>CFBundleURLTypes</key>
<array>
  <!-- Google登录:替换为你的Google客户端ID后缀 -->
  <dict>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>com.googleusercontent.apps.XXXXXX</string>
    </array>
  </dict>
  <!-- Facebook登录:替换为你的Facebook应用ID -->
  <dict>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>fbXXXXXX</string>
    </array>
  </dict>
  <!-- Twitter登录:替换为你的Twitter回调Scheme -->
  <dict>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>twitterkit-XXXXXX</string>
    </array>
  </dict>
</array>

3. 补充必要权限描述

在Info.plist中添加网络权限说明:

<key>NSInternetUsageDescription</key>
<string>需要网络权限完成第三方登录验证</string>

4. 确认web3auth_flutter配置

按照web3auth_flutter官方文档,在Apple开发者账号中配置好对应的关联域名(若需要),并确保回调URL与后台配置一致。


二、解决CocoaPods版本兼容报错

报错说明web3auth_flutter需要更高的iOS最低部署版本,操作步骤:

  1. 打开项目的ios/Podfile文件
  2. 修改最低部署版本为13.0(或更高,以插件要求为准):
    platform :ios, '13.0'
    
  3. 执行以下命令更新Pods:
    cd ios
    pod deintegrate
    pod install
    
  4. 若仍有问题,更新CocoaPods到最新版本:
    sudo gem install cocoapods
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.20 15:51:32