How do I fix Pods update to recommended settings after every flutter build on macOS?

I have been developing a flutter web app for a few years without issue until I decided to refactor it as a native macos app.

Here is a summary of the issues I have faced and how I got around most of them. The journey is far from over.

Out of the box, unable to find pods output files. The fix is to import the files in AppInfo.xcconfig.

I get header issues on build like this:

Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/compliance.nanopb.h:22:

Pods/nanopb/pb_decode.h:9:10: error: 'pb.h' file not found with <angled> include; use "quotes" instead

To get round this I need to run this script before every build:

pod deintegrate
rm -rf Pods
rm Podfile.lock
rm -rf ~/Library/Caches/CocoaPods
rm -rf ~/.cocoapods/repos
pod setup
pod install --repo-update

I can’t build 2 times consecutively without that. Then I can build but flutter run has 2 errors and produces a black screen.

I also need to run a prebuild and after build script to fix headers in the Runner target build phases.

Here is my post build script, they are similar

#!/bin/sh

# Paths to nanopb headers
NANOPB_HEADERS=(
  "${SRCROOT}/Pods/nanopb/pb_common.h"
  "${SRCROOT}/Pods/nanopb/pb_decode.h"
  "${SRCROOT}/Pods/nanopb/pb_encode.h"
  "${SRCROOT}/Pods/nanopb/pb.h"
)

# Paths to PromisesObjC headers
PROMISES_HEADERS=(
  "${SRCROOT}/Pods/PromisesObjC/Sources/FBLPromises/include/FBLPromise+All.h"
  "${SRCROOT}/Pods/PromisesObjC/Sources/FBLPromises/include/FBLPromise+Always.h"
  "${SRCROOT}/Pods/PromisesObjC/Sources/FBLPromises/include/FBLPromise+Any.h"
  "${SRCROOT}/Pods/PromisesObjC/Sources/FBLPromises/include/FBLPromise+Async.h"
  "${SRCROOT}/Pods/PromisesObjC/Sources/FBLPromises/include/FBLPromise+Await.h"
  "${SRCROOT}/Pods/PromisesObjC/Sources/FBLPromises/include/FBLPromise+Catch.h"
  "${SRCROOT}/Pods/PromisesObjC/Sources/FBLPromises/include/FBLPromise+Delay.h"
  "${SRCROOT}/Pods/PromisesObjC/Sources/FBLPromises/include/FBLPromise+Do.h"
  "${SRCROOT}/Pods/PromisesObjC/Sources/FBLPromises/include/FBLPromise+Race.h"
  "${SRCROOT}/Pods/PromisesObjC/Sources/FBLPromises/include/FBLPromise+Recover.h"
  "${SRCROOT}/Pods/PromisesObjC/Sources/FBLPromises/include/FBLPromise+Reduce.h"
  "${SRCROOT}/Pods/PromisesObjC/Sources/FBLPromises/include/FBLPromise+Retry.h"
  "${SRCROOT}/Pods/PromisesObjC/Sources/FBLPromises/include/FBLPromise+Testing.h"
  "${SRCROOT}/Pods/PromisesObjC/Sources/FBLPromises/include/FBLPromise+Then.h"
  "${SRCROOT}/Pods/PromisesObjC/Sources/FBLPromises/include/FBLPromise+Timeout.h"
  "${SRCROOT}/Pods/PromisesObjC/Sources/FBLPromises/include/FBLPromise+Validate.h"
  "${SRCROOT}/Pods/PromisesObjC/Sources/FBLPromises/include/FBLPromise+Wrap.h"
  "${SRCROOT}/Pods/PromisesObjC/Sources/FBLPromises/include/FBLPromise.h"
  "${SRCROOT}/Pods/PromisesObjC/Sources/FBLPromises/include/FBLPromises.h"
  "${SRCROOT}/Pods/PromisesObjC/Sources/FBLPromises/include/FBLPromiseError.h"
)

# Replace double-quoted includes with angle-bracketed includes in nanopb headers
for HEADER in "${NANOPB_HEADERS[@]}"; do
  if [ -f "$HEADER" ]; then
    sed -i '' 's/#include "([^"]*)"/#include <1>/g' "$HEADER"
  fi
done

# Replace double-quoted includes with angle-bracketed includes in PromisesObjC headers
for HEADER in "${PROMISES_HEADERS[@]}"; do
  if [ -f "$HEADER" ]; then
    sed -i '' 's/#include "([^"]*)"/#include <1>/g' "$HEADER"
  fi
done

Even with all this effort Xcode reports that Pods always needs updating after a build. I also see that MainFlutterWindow.swift complains about not finding the FlutterMacOS framework even though AppDelegate.swift needs it and can see it.

I have spent a week trying to resolve these issues and about to give up on Apple dev unless I can find a solution. Cocopods just seems too fragile to use.

Mac m2 version 14.6, Flutter 3.22.3.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật