Flutter The sandbox is not in sync with the Podfile.lock.

前因

在将Flutter项目集成到原生iOS项目中报错:The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation. 。根据描述,是podfile.lock 文件没有同步,flutter的集成包中和Xcode中的文件存在差异。并且还友好的给出了解决方案:pod install。然而并没有解决问题。

解决方案

1、关闭Flutter module工程,关闭Xcode工程,删除podfile.lock文件,删除xxx.xcworkspace 文件,命令如下:

bash 复制代码
cd xxx/project
rm -rf podfile.lock
rm -rf xxx.xcworkspace
//如果不希望更新本地仓库推荐使用
pod install --no-repo-update
//pod install

然后重新打开Xcode,清除缓存。如果可以正常运行,则表示问题已处理。

大多时候这样是不能解决问题的,哈哈。。。

2、打开Xcode->选中工程->选中Project->Info->Configurations。

可以看到下面有两栏,对应debug和release,如果右边的Configurations Set上显示的是None,那么把它改成Pods-xxx.debug 。同理Release 也选上。

然后再次跑起来,不出意外,可以正常运行。

3、找到项目文件的根目录下的Podfile.lock文件,然后再找到Pods文件夹下的Manifest.lock文件,接着复制项目根目录下的Podfile.lock文件的全部内容,直接替换Pods文件夹下的Manifest.lock文件内容,然后重新运行项目,就解决问题了。

4、分享其他文章解决问题的步骤

sql 复制代码
步骤I. 
Project Cleanup 
In the project navigator, select your project Select your target 
Remove all libPods*.a in Linked Frameworks and Libraries 
步骤II. Update CocoaPods Launch Terminal and go to your project directory. 
Update CocoaPods using the command pod install

至此,The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation,问题应该已经解决,Flutter还是有很多坑需要注意的,需要多积累多记录。

相关推荐
与火星的孩子对话11 小时前
Unity进阶课程【六】Android、ios、Pad 终端设备打包局域网IP调试、USB调试、性能检测、控制台打印日志等、C#
android·unity·ios·c#·ip
九丝城主21 小时前
2025使用VM虚拟机安装配置Macos苹果系统下Flutter开发环境保姆级教程--上篇
服务器·flutter·macos·vmware
瓜子三百克1 天前
七、性能优化
flutter·性能优化
恋猫de小郭1 天前
Flutter Widget Preview 功能已合并到 master,提前在体验毛坯的预览支持
android·flutter·ios
点金石游戏出海2 天前
每周资讯 | Krafton斥资750亿日元收购日本动画公司ADK;《崩坏:星穹铁道》新版本首日登顶iOS畅销榜
游戏·ios·业界资讯·apple·崩坏星穹铁道
小蜜蜂嗡嗡2 天前
Android Studio flutter项目运行、打包时间太长
android·flutter·android studio
旷世奇才李先生2 天前
Swift 安装使用教程
开发语言·ios·swift
90后的晨仔2 天前
Xcode16报错: SDK does not contain 'libarclite' at the path '/Applicati
ios
finger244802 天前
谈一谈iOS线程管理
ios·objective-c
Digitally2 天前
如何将大型视频文件从 iPhone 传输到 PC
ios·iphone