简体   繁体   中英

Got an Archive failed when trying “xcodebuild archive” in terminal

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM