     let installedPods = CocoaPodUtils.installPods([pod], inDir: projectDir, customSpecRepos: customSpecRepos)
     // Copy the frameworks into the proper product directory.
     let productDir = rootZipDir.appendingPathComponent(pod.rawValue)
-    try copyFrameworks(fromPods: installedPods,
-                       toDirectory: productDir,
-                       frameworkLocations: builtFrameworks,
-                       podsToIgnore: podsToIgnore,
-                       foldersToIgnore: pod.duplicateFrameworksToRemove())
-
-    // Return the names of all the installed frameworks.
-    let namedFrameworks = installedPods.map { $0.name }
+    let namedFrameworks = try copyFrameworks(fromPods: installedPods,
+                                             toDirectory: productDir,
+                                             frameworkLocations: builtFrameworks,
+                                             podsToIgnore: podsToIgnore,
+                                             foldersToIgnore: pod.duplicateFrameworksToRemove())
+
     let copiedFrameworks = namedFrameworks.filter {
       // Only return the frameworks that aren't contained in the "podsToIgnore" array, aren't an
       // interop framework (since they don't compile to frameworks), or the Firebase pod itself.

  ///   - frameworkLocations: A dictionary containing the pod name as the key and a location to
  ///                         the compiled frameworks.
  ///   - ignoreFrameworks: A list of Pod
  /// - Throws: Various FileManager errors in case the copying fails, or an error if the framework
  //            doesn't exist in `frameworkLocations`.
  private func copyFrameworks(fromPods installedPods: [CocoaPodUtils.PodInfo],
                              toDirectory dir: URL,
                              frameworkLocations: [String: [URL]],
                              podsToIgnore: [String],
                              foldersToIgnore: [String]) throws {
    let fileManager = FileManager.default
    if !fileManager.directoryExists(at: dir) {
      try fileManager.createDirectory(at: dir, withIntermediateDirectories: false, attributes: nil)
    }

    // Loop through each InstalledPod item and get the name so we can fetch the framework and copy
    // it to the destination directory.


        let destination = dir.appendingPathComponent(frameworkName)
        try fileManager.copyItem(at: framework, to: destination)
        copiedFrameworkNames.append(frameworkName.replacingOccurrences(of: ".framework", with: ""))
      }
    }

    return copiedFrameworkNames
  }

  /// Copies required files from the Firebase pod (i.e. `Firebase.h`, `module.modulemap`, etc) into
