'The connection to service named com.apple.fonts was invalidated on xcodebuild -resolvePackageDependencies

I am using fastlane to build my unity iphone application. It worked perfectly until all of a sudden i started getting the following error/warning during build:

[10:13:48]: $ xcodebuild -resolvePackageDependencies -scheme Unity-iPhone -project ./Unity-iPhone.xcodeproj
[10:13:48]: ▸ 2021-11-16 10:13:48.903 xcodebuild[59318:1348378] XType: failed to connect - Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.fonts was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.fonts was invalidated: failed at lookup with error 3 - No such process.}
[10:13:48]: ▸ 2021-11-16 10:13:48.904 xcodebuild[59318:1348378] Font server protocol version mismatch (expected:5 got:0), falling back to local fonts
[10:13:48]: ▸ 2021-11-16 10:13:48.904 xcodebuild[59318:1348378] XType: unable to make a connection to the font daemon!
[10:13:48]: ▸ 2021-11-16 10:13:48.904 xcodebuild[59318:1348378] XType: XTFontStaticRegistry is enabled as fontd is not available.
[10:13:49]: ▸ Command line invocation:
[10:13:49]: ▸     /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -resolvePackageDependencies -scheme Unity-iPhone -project ./Unity-iPhone.xcodeproj
[10:13:49]: ▸ User defaults from command line:
[10:13:49]: ▸     IDEPackageSupportUseBuiltinSCM = YES
[10:13:49]: ▸ resolved source packages: 

This does not always happen but when it does the CodeSign part will fail and ultimately fastlane deploy lane will fail too as a result. Been looking a lot for answers but havnt found anything to help me yet.

Here are some specs:

  • MacOS Monterey 12.0.1
  • xCode version 13.1
  • fastlane version 2.198.0
  • Unity version 2020.3.19f1

Additional Info: i run the deploy from Gitlab CI/CD

Here is my Fastlane file contents:

platform :ios do
  before_all do
    Dotenv.load ".env.ios"
    Dotenv.overload '.env.secret'
  end

  desc "Sync the certificates"
  lane :sync_signing do
    unlock_keychain( password: ENV['KEYCHAIN_SECRET'] )
    sync_code_signing # match
    mapping = Actions.lane_context[SharedValues::MATCH_PROVISIONING_PROFILE_MAPPING]
    update_code_signing_settings(profile_name: mapping[ENV['MATCH_APP_IDENTIFIER']])    
  end


  desc "Build Binary"
  lane :build do
    sync_signing
    build_ios_app # gym
  end


  desc "Deploy to TestFlight"
  lane :deploy do
    increment_build_number(build_number: ENV["CI_PIPELINE_ID"])
    build
    upload_to_testflight # pilot
  end
end

Thank you for any help!



Solution 1:[1]

The thing that I think finally solved it was installing the correct "Apple Worldwide Developer Relations Certification Authority" in Keychain. The one I had had an expiration date of February 2023. I deleted that one and went here: https://www.apple.com/certificateauthority/, downloaded the one called "Worldwide Developer Relations - G3 (Expiring 02/20/2030 00:00:00 UTC)", then retried the build and it worked.

I hope that helps! If it doesn't, lmk, there were some other things I tried that might have solved it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Julian K