Search code examples
swiftalamofireswift-package-manager

Swift IOS library using Swift Package Manager not being able to compile


We are working on an iOS framework built in swift. We have the need to import alamofire in the project for easy networking. The way we compile the library is by building for both sim and device and then with lipo we merge the 2. What I tried so far:

  1. Clone the Alamofire project, use the project strategy: Compile for both platforms and use lipo. That worked incredibly well until we tried to export the IPA of the project that imports it.

ld: symbol(s) not found for architecture arm64
    Exited with 1


error: Failed to compile bundle: /var/folders/8k/89s55x7s3x9c0k0gv5n9vzbh0000gn/T/Alamofirehyhhbn/Alamofire.arm64.xar


Stderr:

>
/Applications/Xcode-11.2.app/Contents/Developer/usr/bin/ipatool:297:in `run'
/Applications/Xcode-11.2.app/Contents/Developer/usr/bin/ipatool:2703:in `block in CompileOrStripBitcodeInBundle'
/Applications/Xcode-11.2.app/Contents/Developer/usr/bin/ipatool:2642:in `each'
/Applications/Xcode-11.2.app/Contents/Developer/usr/bin/ipatool:2642:in `CompileOrStripBitcodeInBundle'
/Applications/Xcode-11.2.app/Contents/Developer/usr/bin/ipatool:2902:in `block in ProcessIPA'
/Applications/Xcode-11.2.app/Contents/Developer/usr/bin/ipatool:2864:in `each'
/Applications/Xcode-11.2.app/Contents/Developer/usr/bin/ipatool:2864:in `ProcessIPA'
/Applications/Xcode-11.2.app/Contents/Developer/usr/bin/ipatool:3811:in `<main>'}

** EXPORT FAILED **
  1. Tried to use Carthage to compile Alamofire. It did work up until exporting. The same issue occurred.

  2. Decided to use Swift Package Manager, it works in normal building the simple framework, even from the terminal but when we want to use the aggregator it fails with:

xcodebuild: error: Could not resolve package dependencies:
The operation couldn’t be completed. (Basic.Process.Error error 0.)

I am quite stuck and cannot figure this out.

See demo https://www.dropbox.com/s/ll4ld4ryespbelr/Test%20Import.zip?dl=0


Solution

  • I have looked over the demo and you need to change the script and remove "env -i". It works after