firebase-ios-sdk icon indicating copy to clipboard operation
firebase-ios-sdk copied to clipboard

Adding FirebaseAnalytics or FirebaseCrashlytics breaks SwiftUI previews on macOS Sequoia in Xcode 16 due to missing slice for arm64e

Open tnymlr opened this issue 1 year ago • 16 comments

Description

After adding FirebaseAnalytics and/or FirebaseCrashlytics as a dependency using SwiftPM on MacOS Sequoia (exact version I'm running is 15.1) in Xcode 16 into an empty, newly create project, SwiftUI previews stop working due to missing slice for arm64e-apple-macosx21.1 architecture

Reproducing the issue

  • Create new macOS app and choose it to be SwiftUI app.
  • Navigate to Package Dependencies
  • Add Firebase using https://github.com/firebase/firebase-ios-sdk.git
  • Check FirebaseAnalytics and/or FirebaseCrashlytics in the list of available packages to add to your target
  • Open generated from the template ContentView and make sure canvas is enabled

Kindly find the project attached.

TestApp.zip

Firebase SDK Version

11.5

Xcode Version

Version 16.1 (16B40)

Installation Method

Swift Package Manager

Firebase Product(s)

Analytics, Crashlytics

Targeted Platforms

macOS

Relevant Log Output

|  |  |  XOJITError: Universal binary /Users/{redacted}/Library/Developer/Xcode/DerivedData/TestApp-etnuldzjfdocfhdtljvfpgieuccp/Build/Products/Debug/FirebaseAnalytics.framework/FirebaseAnalytics does not contain a slice for arm64e-apple-macosx21.1

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet

{
  "originHash" : "a1569f9895aa2be8e24832f98525d5da4eb90b5d158a82691c15b47eb72a13d7",
  "pins" : [
    {
      "identity" : "abseil-cpp-binary",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/abseil-cpp-binary.git",
      "state" : {
        "revision" : "194a6706acbd25e4ef639bcaddea16e8758a3e27",
        "version" : "1.2024011602.0"
      }
    },
    {
      "identity" : "app-check",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/app-check.git",
      "state" : {
        "revision" : "61b85103a1aeed8218f17c794687781505fbbef5",
        "version" : "11.2.0"
      }
    },
    {
      "identity" : "firebase-ios-sdk",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/firebase/firebase-ios-sdk.git",
      "state" : {
        "revision" : "dbdfdc44bee8b8e4eaa5ec27eb12b9338f3f2bc1",
        "version" : "11.5.0"
      }
    },
    {
      "identity" : "googleappmeasurement",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/GoogleAppMeasurement.git",
      "state" : {
        "revision" : "4f234bcbdae841d7015258fbbf8e7743a39b8200",
        "version" : "11.4.0"
      }
    },
    {
      "identity" : "googledatatransport",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/GoogleDataTransport.git",
      "state" : {
        "revision" : "617af071af9aa1d6a091d59a202910ac482128f9",
        "version" : "10.1.0"
      }
    },
    {
      "identity" : "googleutilities",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/GoogleUtilities.git",
      "state" : {
        "revision" : "53156c7ec267db846e6b64c9f4c4e31ba4cf75eb",
        "version" : "8.0.2"
      }
    },
    {
      "identity" : "grpc-binary",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/grpc-binary.git",
      "state" : {
        "revision" : "f56d8fc3162de9a498377c7b6cea43431f4f5083",
        "version" : "1.65.1"
      }
    },
    {
      "identity" : "gtm-session-fetcher",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/gtm-session-fetcher.git",
      "state" : {
        "revision" : "5cfe5f090c982de9c58605d2a82a4fc77b774fbd",
        "version" : "4.1.0"
      }
    },
    {
      "identity" : "interop-ios-for-google-sdks",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/interop-ios-for-google-sdks.git",
      "state" : {
        "revision" : "2d12673670417654f08f5f90fdd62926dc3a2648",
        "version" : "100.0.0"
      }
    },
    {
      "identity" : "leveldb",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/firebase/leveldb.git",
      "state" : {
        "revision" : "a0bc79961d7be727d258d33d5a6b2f1023270ba1",
        "version" : "1.22.5"
      }
    },
    {
      "identity" : "nanopb",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/firebase/nanopb.git",
      "state" : {
        "revision" : "b7e1104502eca3a213b46303391ca4d3bc8ddec1",
        "version" : "2.30910.0"
      }
    },
    {
      "identity" : "promises",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/promises.git",
      "state" : {
        "revision" : "540318ecedd63d883069ae7f1ed811a2df00b6ac",
        "version" : "2.4.0"
      }
    },
    {
      "identity" : "swift-protobuf",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apple/swift-protobuf.git",
      "state" : {
        "revision" : "ebc7251dd5b37f627c93698e4374084d98409633",
        "version" : "1.28.2"
      }
    }
  ],
  "version" : 3
}

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet

Replace this line with the contents of your Podfile.lock!

tnymlr avatar Nov 16 '24 09:11 tnymlr

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

google-oss-bot avatar Nov 16 '24 09:11 google-oss-bot

Thanks for reporting, @tnymlr. This seems related to #13603. I was able to reproduce the issue but the issue disappeared when I tried to disable the Legacy Previews Execution in Editor -> Canvas. Could you try if this works for you?

rizafran avatar Nov 18 '24 13:11 rizafran

@rizafran Indeed, it is related, I believe the root cause is the same. And yes, the setting does solve the problem.

tnymlr avatar Nov 18 '24 13:11 tnymlr

Thanks for the update, @tnymlr. I'm glad to hear that the issue has been resolved. I'll now be closing this ticket but feel free to comment if you encounter the issue again or if you have other questions.

rizafran avatar Nov 20 '24 11:11 rizafran

Can we reopen this one @rizafran ? Relying on Legacy Preview mode isn't an option for us.

tristan-warner-smith avatar Nov 23 '24 14:11 tristan-warner-smith

I suspect that like #13603, this is an Apple issue, but I'll reopen for additional analysis and thumbs-ups.

paulb777 avatar Nov 23 '24 16:11 paulb777

fwiw, issue persists in macOS 15.2 with Xcode 16.2

vade avatar Dec 13 '24 22:12 vade

Thanks, @vade. I will update my feedback ticket. It appears there was a previews fix that went into Xcode 16.1, but it didn't resolve the issue this thread is documenting.

ncooke3 avatar Dec 13 '24 22:12 ncooke3

Good luck haha. I think we're all gonna need it.

vade avatar Dec 13 '24 22:12 vade

Hmm, I'm able to successfully preview the attached TestApp with Xcode 16.2 on macOS 14.7.1. Perhaps this is a macOS 15 only issue?

paulb777 avatar Dec 20 '24 22:12 paulb777

Is changing the Deployment Target a workaround?

Image

paulb777 avatar Dec 20 '24 22:12 paulb777

In our case the only platform is iOS where this issue continues to manifest, so changing the deployment target isn't a workaround. We're compiling on Sonoma machines, but not deploying for macOS.

tristan-warner-smith avatar Jan 15 '25 16:01 tristan-warner-smith

The Xcode 16.3 beta release notes list several fixes: https://developer.apple.com/documentation/xcode-release-notes/xcode-16_3-release-notes#Previews

paulb777 avatar Feb 23 '25 22:02 paulb777

Thanks for reporting, @tnymlr. This seems related to #13603. I was able to reproduce the issue but the issue disappeared when I tried to disable the Legacy Previews Execution in Editor -> Canvas. Could you try if this works for you?

use legacy previews execution

I checked this option to preview normally. 😭 Xcode 16.3 (16E140) & macOS 15.4

jksmx avatar Apr 17 '25 03:04 jksmx