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 文件,命令如下:
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、分享其他文章解决问题的步骤
步骤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还是有很多坑需要注意的,需要多积累多记录。
转载自:https://juejin.cn/post/7309921568493223973