skip to Main Content

I recently updated to a new MacBook Pro 13" M1 and have setup Cocoapods and Ruby 3.0 to get my Xcode Workspace running.

When previously running the same codebase, same commit on Xcode 13 on x86 MBP, all of by Build Schemes [Prod ==> Release; QA ==> Debug] build and run.

On my M1 MBP, the Prod scheme (on Release configuration), builds and runs. However, when I switch to the QA scheme (on Debug configuration), the build immediately fails.

In my bridging header file, get an error 'UIScrollView_InfiniteScroll/UIScrollView+InfiniteScroll.h' file not found from the following line:

#import <UIScrollView_InfiniteScroll/UIScrollView+InfiniteScroll.h>

It also throws the following error:

<unknown>:0: error: failed to emit precompiled header '/Users/admin/Library/Developer/Xcode/DerivedData/myapp-dypuhuippmcjrlhhmqiqgbjwgyof/Build/Intermediates.noindex/PrecompiledHeaders/My-Bridging-Header-swift_3V1NLTT25PR6H-clang_1XGU9G22VPOI.pch' for bridging header '/Users/admin/myapp/myapp/myapp/Supporting Files/My-Bridging-Header.h'
/Users/admin/myapp/myapp/myapp/Supporting Files/My-Bridging-Header.h:5:9: note: in file included from /Users/admin/myapp/myapp/myapp/Supporting Files/My-Bridging-Header.h:5:

I have confirmed that there are no significant changes across configurations in my build settings. I have tried enabling Validate Workspace = NO.

The main significant difference between the schemas is the configurations (Release vs. Debug).

When I examine /Users/admin/Library/Developer/Xcode/DerivedData/MyApp-dypuhuippmcjrlhhmqiqgbjwgyof/Build/Intermediates.noindex/Pods.build there is a folder for Release-iphonesimulator but nothing for Debug. This leads me to believe that there is a Cocoapods issue underlying this, and that, despite all configurations being set for the Pods Xcode project, the Debug pods are not being built.

Attached is my current pod env:

### Stack

   CocoaPods : 1.11.2
        Ruby : ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [arm64-darwin20]
    RubyGems : 3.2.22
        Host : macOS 11.6 (20G165)
       Xcode : 13.0 (13A233)
         Git : git version 2.30.1 (Apple Git-130)
Ruby lib dir : /Users/admin/homebrew/Cellar/ruby/3.0.2_1/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/

### Installation Source

Executable Path: /Users/admin/homebrew/lib/ruby/gems/3.0.0/bin/pod

### Plugins

cocoapods-deintegrate : 1.0.5
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.1
cocoapods-trunk       : 1.6.0
cocoapods-try         : 1.2.0

### Podfile

platform :ios, '11.0'

target 'Geojam' do
  use_frameworks! :linkage => :static

pod 'Alamofire', '~> 4.8.2'
pod 'Kingfisher', '~> 6.3.0'
pod 'IQKeyboardManagerSwift', '~> 6.3.0'
pod 'PromiseKit', '~> 6.8.0'
pod 'SwipeMenuViewController'
pod 'UIScrollView-InfiniteScroll', '~> 1.1.0'
pod 'PhoneNumberKit', '~> 3.1'
pod 'Blueprints'
pod 'Toaster', :git => 'https://github.com/DominatorVbN/Toaster.git', :branch => 'master'
pod "Atributika"
pod 'Instabug'
pod 'Sentry', :git => 'https://github.com/getsentry/sentry-cocoa.git', :tag => '7.3.0'

# DB

# Reactive
pod 'ReactiveSwift', '~> 6.1'

# Firebase
pod 'Firebase', '7.7.0'
pod 'FirebaseAuth', '7.7.0'
pod 'FirebaseMessaging', '7.7.0'
pod 'FirebaseFirestore', '7.7.0'
pod 'FirebaseStorage', '7.7.0'
pod 'GooglePlaces', '4.2.0'

# Add the pod for Firebase Crashlytics
pod 'Firebase/Crashlytics'
# Recommended: Add the Firebase pod for Google Analytics
pod 'Firebase/Analytics'

#API Debug
pod 'netfox'
end

post_install do |pi|
  pi.pods_project.targets.each do |t|
      t.build_configurations.each do |config|
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
          config.build_settings["ONLY_ACTIVE_ARCH"] = "YES"
      end
  end
end

2

Answers


  1. Chosen as BEST ANSWER

    The issue was a lack of Excluded Architectures being set in the Pods.xcodeproj file upon pod install execution.

    I fixed it by adding the following post-install script:

    post_install do |pi|
      pi.pods_project.build_configurations.each do |config|
        config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
      end
    

    This adds an exclusion for each configuration at the project level, which is what's required.

    I do wish Cocoapods could make this automatic, but in the meanwhile you gotta set it yourself!


  2. Run your Xcode through Rosetta.
    Find Xcode in Finder, right click, get info, and then a window should pop up to the left. Check the box that says “Open using Rosetta”

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search