简体   繁体   中英

Xcode + Swift 4 + Mac M1: Non-stop random build errors

I'm new to iOS development and I'm already starting to hate it:)

I cannot paste code as I'm afraid it's not a code problem, but something related to xcode or the fact I own an M1 Mac.

I'm migrating an old iOS app written in Objective-C with some parts in Swift 3, and the problem started migrating Swift 3 to 4.

The app throws different errors when building. I guess they're all related to Cocoapods libraries (at least most of them are AWS SDK related). I have to say I have Cocoapods installed and running.

I've found references saying there are problems with new M1 Macs, but cannot find a working solution to this.

I've checked this:

Error: Could not build Objective-C module 'Firebase'

and this:

Xcode errors appearing and disappearing with every build (clean doesn't help)

and in one they suggest "Get Info" over Xcode app and enable open with "Rosetta", but even I've tried that it didn't work (have no idea what is Rosetta though).

Of course I've done the common troubleshooting like this:

  1. Clean + rebuild
  2. pod install
  3. pod update
  4. Exclude arquitectures > arm64 (mentioned in another SO question)

Nothing works and I'm stuck.

This is a screenshot of my current build attempt:

在此处输入图像描述

Any help to make my app build?

Edit 1:

I was adviced to use SPM instead of Cocoapods, and I'm considering that, but the problem is my app uses AWS SDK, and as far as I know there is no official AWS SDK for SPM yet. Apart from that I'm afraid I'll have to rewrite a lot of code if I switch the package manager, because I'm sure I won't find the same exact packages so the code fits without refactoring and rewriting.

My app is very old, true, and like it or not I know I'll end rewriting it, but meanwhile, and to muddle through, it's important for me to get it to build and run.

Try switching to Swift Package Manager and let Xcode manage the dependencies across languages and platforms.

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