7

I have created a framework with few cocoapod dependencies .The archive for the framework is failing when i do 'xcodebuild archive' after adding the pod files (Did pod install).

In the normal build, it is working fine. There is no error and the build is successful but when I do 'xcodebuild archive' on my terminal got this below issue.

error: no such module 'Lottie'
import Lottie
       ^

** ARCHIVE FAILED **


The following build commands failed:
    CompileSwift normal arm64 /Users/surya/Documents/Projects/Sampe\ lottie\ test/TestFramework/TestFramework/ViewController.swift
    CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
(2 failures)

Below is my xcode build archive command

xcodebuild archive \
-scheme TestFramework \
-destination "generic/platform=iOS" \
-archivePath ../Output/TestFramework.framework-iphoneos.xcarchive \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
Surya
  • 602
  • 5
  • 14

1 Answers1

17

Found the answer - we need to add - workspace ProjectName.xcworkspace, if our framework uses pods. Check the below command

xcodebuild archive -workspace projectName.xcworkspace \
  -scheme projectName \                                                                        
  -sdk iphonesimulator \                                                                         
  -archivePath "./archives/ios_Simulators.xcarchive" \
  BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
  SKIP_INSTALL=NO
Surya
  • 602
  • 5
  • 14
  • Thanks! am also getting error for my framework where as it has other frameworks as dependency. SwiftEmitModule normal arm64 Emitting\ module\ for\ XXX (in target 'XXX' from project 'XXX') – SreekanthI Feb 13 '23 at 17:03