Xcode building for iOS Simulator, but linking in an object file built for iOS, for architecture 'arm64'

IosXcodeXcode12Xcode12beta5Xcode12beta6

Ios Problem Overview


I am trying to get a large (and working on Xcode 11!) project building in Xcode 12 (beta 5) to prepare for iOS 14. The codebase was previously in Objective-C, but now it contains both Objective-C and Swift, and uses pods that are Objective-C and/or Swift as well.

I have pulled the new beta of CocoaPods with Xcode 12 support (currently 1.10.0.beta 2).

Pod install is successful. When I do a build, I get the following error on a pod framework:

> building for iOS Simulator, but linking in object file built for iOS, for architecture arm64

and possibly also the error:

> Unable to load standard library for target 'arm64-apple-ios11.0'

When I go run lipo -info on the framework, it has: armv7s armv7 i386 x86_64 arm64.

Previously, the project had Valid Architectures set to: armv7, armv7s and arm64.

In Xcode 12, that setting goes away, as per Apple's documentation. Architectures is set to $(ARCHS_STANDARD). I have nothing set in excluded architectures.

What may be going on here? I have not been able to reproduce this with a simpler project yet.

Ios Solutions


Solution 1 - Ios

Basically, you have to exclude arm64 for the simulator architecture, both from your project and the Pod project,

  • To do that, navigate to Build Settings of your project and add Any iOS Simulator SDK with value arm64 inside Excluded Architecture.

    Enter image description here

OR

  • If you are using custom XCConfig files, you can simply add this line for excluding simulator architecture.

    EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64
    

    Then

    You have to do the same for the Pod project until all the Cocoa pod vendors are done adding following in their Podspec.

    s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
    s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
    

    You can manually add the Excluded Architecture in your Pod project's Build Settings, but it will be overwritten when you use pod install.

    In place of this, you can add this snippet in your Podfile. It will write the necessary Build Settings every time you run pod install.

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

Solution 2 - Ios

TL;DR;

Set "Build Active Architecture Only (ONLY_ACTIVE_ARCH)" to Yes for your libraries/apps, even for release mode.


While trying to identify the root cause of the issue I realized some fun facts about Xcode 12.

  1. Xcode 12 is actually the stepping stone for Apple silicon which unfortunately is not yet available (when the answer was written). But with that platform we are going to get an arm64-based macOS where simulators will also run on the arm64 architecture unlike the present Intel-based x86_64 architecture.

  2. Xcode usually depends on the "Run Destination" to build its libraries/applications. So when a simulator is chosen as the "Run Destination", it builds the app for available simulator architectures and when a device is chosen as the "Run Destination" it builds for the architecture that the device supports (arm*).

  3. xcodebuild, in the Xcode 12+ build system considers arm64 as a valid architecture for simulator to support Apple silicon. So when a simulator is chosen as the run destination, it can potentially try to compile/link your libs/apps against arm64 based simulators, as well. So it sends clang(++) some -target flag like arm64-apple-ios13.0-simulator in <architecture>-<os>-<sdk>-<destination> format and clang tries to build/link against an arm64-based simulator that eventually fails on an Intel based Mac.

  4. But xcodebuild tries this only for Release builds. Why? Because, "Build Active Architecture Only (ONLY_ACTIVE_ARCH)" build settings is usually set to "No" for the "Release" configuration only. And that means xcodebuild will try to build all architectural variants of your libs/apps for the selected run destination for release builds. And for the Simulator run destination, it will includes both x86_64 and arm64 now on, since arm64 in Xcode 12+ is also a supported architecture for simulators to support Apple silicon.

Simply putting, Xcode will fail to build your application anytime it tries the command line, xcodebuild, (which defaults to release build, see the general tab of your project setting) or otherwise and tries to build all architectural variants supported by the run destination. So a simple workaround to this issue is to set "Build Active Architecture Only (ONLY_ACTIVE_ARCH)" to Yes in your libraries/apps, even for release mode.

Enter image description here

Enter image description here

If the libraries are included as Pods and you have access to .podspec you can simply set:

> spec.pod_target_xcconfig = { 'ONLY_ACTIVE_ARCH' => 'YES' }

> spec.user_target_xcconfig = { 'ONLY_ACTIVE_ARCH' => 'YES' } # not > recommended

I personally don't like the second line since pods shouldn't pollute the target project and it could be overridden in the target settings, itself. So it should be the responsibility of the consumer project to override the setting by some means. However, this could be necessary for successful linting of podspecs.

However, if you don't have access to the .podspec, you can always update the settings during installation of the pods:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings["ONLY_ACTIVE_ARCH"] = "YES"
    end
  end
end

One thing I was concerned about that what will be the impact of this when we actually archive the libraries and applications. During archiving applications usually take the "Release" configuration and since this will be creating a release build considering only the active architecture of the current run destination, with this approach, we may lose the slices for armv7, armv7s, etc. from the target build. However, I noticed the documentation says (highlighted in the attached picture) that this setting will be ignored when we choose "Generic iOS Device/Any Device" as the run destination, since it doesn't define any specific architecture. So I guess we should be good if we archive our app choosing that as a run destination.

Solution 3 - Ios

I found a solution! SwiftUI Previews not working with Firebase

If you set excluded architectures for the simulator to arm64 it will compile.

Excluding architectures for the simulator

Solution 4 - Ios

The proposed answers are outdated/incorrect.

You should initially try to update both CocoaPods and the dependencies for your library/app, and then, if that doesn't work, contact the vendors of any dependencies you are using to see if they have an update in progress to add support for arm64 Simulator slices on M1 Macs.

There are a lot of answers on here marked as correct suggesting that you should exclude arm64 from the list of supported architectures. This is at best a very temporary workaround, and at worst it will spread this issue to other consumers of your libraries. If you exclude the arm64 Simulator slice, there will be performance impacts on apps that you're developing in the Simulator (which in turn can lead to reduced battery time for your shiny new M1 kit while you're developing your amazing ideas).

Solution 5 - Ios

The Valid Architectures build setting has been removed in Xcode 12. If you had values in this build setting, they're causing a problem and need to be removed.

I was able to "clear out" the VALID_ARCHS build setting by adding it back in as a user-defined build setting (with no values), running the project (which failed), and then deleting the VALID_ARCHS build setting. After that, I was able to run on the simulator.

My Architectures build setting is Standard Architectures.

You can add a user-defined setting from the plus button in Build Settings:

User-defined setting

Solution 6 - Ios

Xcode 12.3

I solved this problem by setting Validate Workspace to Yes

enter image description here

Solution 7 - Ios

Hidden Gem in all these answers

I had changed "Excluded Architectures" in my target for the main project, but not for the PODS project. Truly hidden gem. I have been with this problem for weeks now. Excluding arm64 in PODS PROJECT

Solution 8 - Ios

After trying and searching different solutions, I think the most safest way is adding the following code at the end of the Podfile

post_install do |pi|
   pi.pods_project.targets.each do |t|
       t.build_configurations.each do |bc|
          bc.build_settings['ARCHS[sdk=iphonesimulator*]'] =  `uname -m`
       end
   end
end

This way you only override the iOS simulator's compiler architecture as your current cpu's architecture. Compared to others, this solution will also work on computers with Apple Silicon.

Solution 9 - Ios

Easy fix
  1. Right click on xcode in Applications folder
  2. Get info
  3. Select "Open using Rosetta"

Run.

Xcode get info

Solution 10 - Ios

For me the following setting worked:

Build SettingsExcluded Architectures.

I added "arm64" to both Release and Debug mode for the "Any iOS Simulator SDK" option.

Enter image description here

Solution 11 - Ios

Go to Targets section, select each target and do the following:

  • Set Build Active Architecture Only to YES
  • Add Excluded Architectures and set its value to arm64 (See attached)
  • Set Active scheme (on toolbar next to project name) to any iOS Simulator
  • Clean Build folder from Product Menu and build.

enter image description here

Solution 12 - Ios

I found that

  1. Using Rosetta (Find Xcode in Finder > Get Info > Open using Rosetta)
  2. Build Active Architecture Only set to YES for everything, in both Project and Target
  3. (You might not need it, read comment below) And including this in the podfile:
post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings["ONLY_ACTIVE_ARCH"] = "YES"
    end
  end
end

worked for me.

We had both Pods and SPM and they didn't work with any of the combinations of other answers. My colleagues all use Intel MacBooks and everything still works for them too!

Solution 13 - Ios

I solved the problem by adding "arm64" in "Excluded Architectures" for both the project target and pod target.

Xcode → Target ProjectBuild SettingExcluded Architectures → *"arm64"

Xcode → Pod TargetBuild SettingExcluded Architectures → *"arm64"

Solution 14 - Ios

If you have trouble in Xcode 12 with simulators, not real device, yes you have to remove VALID_ARCHS settings because it's not supported anymore. Go to "builds settings", search "VALID_ARCHS", and remove the user-defined properties. Do it in every target you have.

Still, you may need to add a script at the bottom of your podfile to have pods compiling with the right architecture and deployment target:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
      config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
     end
  end
end

Solution 15 - Ios

After upgrading to Xcode 12 I was still able to build for a real device, but not the simulator. The Podfile build was working only for the real device.

I deleted VALID_ARCHS under Build Settings > User-Defined and it worked! Bashing my head for some time before finding this.

Solution 16 - Ios

1.Add arm64 to Build settings -> Exclude Architecture in all the targets.

Xcode ScreenShoot

2.Close Xcode and follow the steps below to open

  1. Right-click on Xcode in Finder
  2. Get Info
  3. Open with Rosetta

Solution 17 - Ios

Xcode 12

Removing VALID_ARCH from Build settings under User-Defined group work for me.

enter image description here

Solution 18 - Ios

I was having issues building frameworks from the command line. My framework depends on other frameworks that were missing support for ARM-based simulators. I ended up excluding support for ARM-based simulators until I upgrade my dependencies.

I needed the EXCLUDED_ARCHS=arm64 flag when building the framework for simulators from the command line.

xcodebuild archive -project [project] -scheme [scheme] -destination "generic/platform=iOS Simulator" -archivePath "archives/[scheme]-iOS-Simulator" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES EXCLUDED_ARCHS=arm64

Solution 19 - Ios

I believe I found the answer. Per the Xcode 12 beta 6 release notes:

"The Build Settings editor no longer includes the Valid Architectures build setting (VALID_ARCHS), and its use is discouraged. Instead, there is a new Excluded Architectures build setting (EXCLUDED_ARCHS). If a project includes VALID_ARCHS, the setting is displayed in the User-Defined section of the Build Settings editor. (15145028)"

I was able to resolve this issue by manually editing the project file (I could not figure out how to remove the item from the project file using Xcode) and removing all lines referring to VALID_ARCHS. After that, I am able to build for the simulator fine.

Solution 20 - Ios

After trying almost every answer to the question and reading through Apple developer forums I found only one solution worked for me.

I am building a universal framework that is consumed in a Swift app. I was unable to build to the simulator without architecture errors.

In my framework project I have a Universal Framework task in my build phases. If this is the case for you:

  • Add the following to your xcodebuild task inside the build phase: EXCLUDED_ARCHS="arm64"

Next you have to change the following project Build Settings:

  • Delete the VALID_ARCHS user defined setting
  • Set ONLY_ACTIVE_ARCH to YES ***

*** If you are developing a framework and have a demo application as well, this setting has to be turned on in both projects.

Solution 21 - Ios

I was facing the same issue and trying to launch a React Native app on an M1 Mac. Note that my Intel Mac with the same project worked well without this error.

What solved the problem for me was to force Xcode to open through Rosetta.

To achieve this:

Right click on Xcode in Applications folder* → Get Info → check 'Open using Rosetta' checkbox.

Solution 22 - Ios

In your xxx.framework podspec file, add the following configuration. Avoid a pod package that contains arm64 simulator architectures.

s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }

Solution 23 - Ios

I was also experiencing the same issue with specific library that was installed through carthage. For those who are using Carthage, as Carthage doesn't work out of the box with Xcode 12, this document will guide through a workaround that works for most cases. Well, shortly, Carthage builds fat frameworks, which means that the framework contains binaries for all supported architectures. Until Apple Sillicon was introduced it all worked just fine, but now there is a conflict as there are duplicate architectures (arm64 for devices and arm64 for simulator). This means that Carthage cannot link architecture specific frameworks to a single fat framework.

You can follow the instruction here. Carthage XCODE 12

Then after you configure the Carthage. Put the arm64 in the "Excluded Architectures" on build settings. enter image description here

Try to run your project using simulator. Simulator should run without any errors.

Solution 24 - Ios

Please, don't forget to clean the build folder after you add arm64 to excluded architecture.

Solution 25 - Ios

Go to finder -> Applications -> Xcode -> Right click on Xcode -> Select open using rosetta

enter image description here

Solution 26 - Ios

The problem here are the Valid architectures in Xcode 11. Open the project in Xcode 11 and change the Valid architectures value to $(ARCHS_STANDARD) for both your project, target and Pods. Reopen the project in Xcode 12 and build.

Solution 27 - Ios

Updates: Oct 2020

You can simply set arm64 only for Debug > Simulator - iOS 14.O SDK under Excluded Architecture.

enter image description here

Solution 28 - Ios

First, generate x86_64 for Pod projects!!!!

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['ARCHS'] = "arm64 x86_64"
        end
    end
end

Second, add "x86_64" for VALID_ARCHS.

Enter image description here

I found this after trying a lot of useless answers online, and this works for me.

Solution 29 - Ios

Xcode 13.2.1, Monterey, target iOS 14.0, cocoapod 1.11.2

I had a similar issue when including LogRocket and/or Plaid -- they are xcframeworks, works fine on my local but can't be built on bitrise, I'd tried all answers above:

  • EXCLUDED_ARCHS arm64
  • setting ONLY_ACTIVE_ARCH to YES in Podfile
  • VALIDATE_WORKSPACE to YES
  • setting ARCHS[sdk=iphonesimulator*] to uname -m in Podfile

none of them works

but by specifying target iOS version or delete it would work:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0'
      # OR
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end
  end
end

Solution 30 - Ios

Issue when compiling for the simulator:

Building for the iOS simulator, but linking in an object file built for iOS, for architecture arm64
Xcode 12.1, Pod 1.9.1

My project structure

  • Main Target
  • Share Extension
  • Notification service extension
  • Submodule, Custom Framework
  • Podfile
  1. Add arm64 to Build settings -> Exclude Architecture in all the targets.

    Enter image description here

  2. Removed arm64 from VALID_ARCHS and added x86_64 in all the targets.

    Enter image description here

  3. Add following code in podfile

    post_install do |installer|
        installer.pods_project.build_configurations.each do |config|
        config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
     end
    end
    
  4. Did pod update, deleted podfile.lock, and did pod install

  5. Do a clean build.

Solution 31 - Ios

It worked for me when I set $(ARCHS_STANDARD) for VALID_ARCHS for Debug for Any iOS Simulator SDK. Also I have set YES for ONLY_ACTIVE_ARCH for Debug.

enter image description here

Solution 32 - Ios

In my case updating CocoaPods helped:

  1. Uninstall CocoaPods if installed:

    sudo gem uninstall cocoapods
    
  2. Install CocoaPods:

    brew install cocoapods
    
  3. If you have a linking error:

    brew link --overwrite cocoapods`
    
  4. Run pod install

Solution 33 - Ios

On Build Settings search VALID_ARCH then press delete. This should work for me with Xcode 12.0.1

VALID_ARCH on build settings

Solution 34 - Ios

In my case, the error was thrown by GTMAppAuth which I was using with Google sign in my Flutter project.

Solution: You have to go to that package and click YES in Build Active Architecture Only.

Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture arm64

Solution 35 - Ios

In the below image, in Excluded Architectures → in debug and release tap + button → in both debug and release.

Enter image description here

Solution 36 - Ios

In my case:

I had four configurations (+ DebugQa and ReleaseQa). Cocoapods is used as a dependency Manager.

For DebugQa, I gathered on the device and in the simulator, and on ReleaseQa only on the device.

It helped to set BuildActiveArchitecture to "yes" in PodsProject.

Solution 37 - Ios

In my case, I was trying to run on an watchOS 7 simulator in Release mode, but the iOS 14 simulator was in Debug mode.

So simply putting both simulators in Debug/Release mode solved the problem for me!

Solution 38 - Ios

In my case: Xcode 12

I set empty values on EXCLUDED_ARCHS and set ONLY_ACTIVE_ARCH Debug = YES Release = NO Project's Build Setting

and I included this in my Podfile:

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

It runs on my Simulator iPhone 8 (iOS 12) and iPhone 11 Pro Max (iOS 14) and on my device iPhone 7 Plus (iOS 13.4)

Solution 39 - Ios

Set the "Build Active Architecture Only"(ONLY_ACTIVE_ARCH) build setting to yes, xcode is asking for arm64 because of Silicon MAC architecture which is arm64.

arm64 has been added as simulator arch in Xcode12 to support Silicon MAC.

> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/SDKSettings.json

Solution 40 - Ios

Switch Build Configuration back to Debug mode or turn on Build Active Architecture Only for both Debug and Release mode.

The reason is your library/framework doesn't support new simulator architecture ARM64 (run on Mac with an Apple silicon processor).

Solution 41 - Ios

Add line "arm64" (without quotes) to path: Xcode* → ProjectBuild settingsArchitecturesExcluded architectures.

Also, do the same for Pods. In both cases, for both debug and release fields.

Or in detail...

Errors mentioned here while deploying to simulator using Xcode 12 are also one of the things which have affected me. Just right-clicking on each of my projects and showing in finder, opening the .xcodeproj in Atom, then going through the .pbxproj and removing all of the VALIDARCHS settings. This was is what got it working for me.

I tried a few of the other suggestions (excluding arm64, Build Active Architecture Only) which seemed to get my build further, but ultimately leave me at another error. Having VALIDARCH settings lying around is probably the best thing to check for first.

Solution 42 - Ios

Only add Any iOS Simulator SDKx86_64 to Project's Build SettingsVALID_ARCHS works for me.

Xcode version: 12.1 (12A7403)

Enter image description here

If your project includes some frameworks that don't support x86_64.

  • You can add these framework names(xxx.framework) to TargetBuild SettingsExcluded Source File NamesDebugAny iOS Simulator SDK.
  • And then modify the Framework Search Paths to delete the paths of these frameworks for DebugAny iOS Simulator SDK.

These two settings can avoid Xcode to build and link these frameworks in simulator mode.

Enter image description here

Enter image description here

Solution 43 - Ios

I understand the issue with arm64 and Xcode 12 and I was able to resolve build issues by excluding the arm64 architecture for iPhone Simulator or by setting ONLY_ACTIVE_ARCH for Release scheme. However I still have problems to push my framework using pod repo push.

I found out that setting s.pod_target_xcconfig in my podspec does not apply this setting to dependencies defined in the same podspec. I can see it in the dummy App project that Cocoapods is generating during the validation. Cocoapods validation is running release scheme for simulator and this is failing when one or more dependencies doesn't exclude arm64 or is not set to build active architecture only.

A solution could be to force Cocoapods to add post install script while validating the project or let it build Debug scheme, because the Debug scheme is only building active architecture.

I ended up using Xcode 11 to release my pod to pass the validation. You can download Xcode 11 from developer.apple.com, copy it to Applications folder as Xcode11.app and switch using sudo xcode-select --switch /Applications/Xcode11.app/Contents/Developer. Don't forget to switch back when done.

Solution 44 - Ios

After excluding arm64 I always got ARCHS[@]: unbound variable. For me the only solution was to add x86_64 to the target build setting as mentioned here https://stackoverflow.com/questions/63993084/problems-after-upgrading-to-xcode-12ld-building-for-ios-simulator-but-linking You also might remove the exclude arm64 you added before.

Solution 45 - Ios

I was trying to build xcFramework when I faced this issue. Nothing was helping, but I managed to resolve this with lipo and am sharing my script:

OUTPUT_DIR_PATH="${PROJECT_DIR}/XCFramework"

function archivePathSimulator {
    local DIR=${OUTPUT_DIR_PATH}/archives/"${1}-SIMULATOR"
    echo "${DIR}"
}

function archivePathDevice {
    local DIR=${OUTPUT_DIR_PATH}/archives/"${1}-DEVICE"
    echo "${DIR}"
}

function archive {
    echo "▸ Starts archiving the scheme: ${1} for destination: ${2};\n▸ Archive path: ${3}.xcarchive"
    xcodebuild clean archive \
    -project "${PROJECT_NAME}.xcodeproj" \
    -scheme ${1} \
    -configuration ${CONFIGURATION} \
    -destination "${2}" \
    -archivePath "${3}" \
    SKIP_INSTALL=NO \
    OBJROOT="${OBJROOT}/DependentBuilds" \
    BUILD_LIBRARY_FOR_DISTRIBUTION=YES | xcpretty
}

# Builds archive for iOS simulator & device
function buildArchive {
    SCHEME=${1}

    archive $SCHEME "generic/platform=iOS Simulator" $(archivePathSimulator $SCHEME)
    archive $SCHEME "generic/platform=iOS" $(archivePathDevice $SCHEME)
}

# Creates xc framework
function createXCFramework {
    FRAMEWORK_ARCHIVE_PATH_POSTFIX=".xcarchive/Products/Library/Frameworks"
    FRAMEWORK_SIMULATOR_DIR="$(archivePathSimulator $1)${FRAMEWORK_ARCHIVE_PATH_POSTFIX}"
    FRAMEWORK_DEVICE_DIR="$(archivePathDevice $1)${FRAMEWORK_ARCHIVE_PATH_POSTFIX}"

    echo "Removing ${FRAMEWORK_SIMULATOR_DIR}/${1}.framework/${1}"

    if lipo "${FRAMEWORK_SIMULATOR_DIR}/${1}.framework/${1}" -verify_arch "arm64"; then
        echo "Removing arm64"
        lipo -remove "arm64" -output "${FRAMEWORK_SIMULATOR_DIR}/${1}.framework/${1}" "${FRAMEWORK_SIMULATOR_DIR}/${1}.framework/${1}"
    fi

    xcodebuild -create-xcframework \
               -framework ${FRAMEWORK_SIMULATOR_DIR}/${1}.framework \
               -framework ${FRAMEWORK_DEVICE_DIR}/${1}.framework \
               -output ${OUTPUT_DIR_PATH}/xcframeworks/${1}.xcframework
}

echo "#####################"
echo "▸ Cleaning the dir: ${OUTPUT_DIR_PATH}"
rm -rf $OUTPUT_DIR_PATH

DYNAMIC_FRAMEWORK="${PROJECT_NAME}"

echo "▸ Archive $DYNAMIC_FRAMEWORK"
buildArchive ${DYNAMIC_FRAMEWORK}

echo "▸ Create $DYNAMIC_FRAMEWORK.xcframework"
createXCFramework ${DYNAMIC_FRAMEWORK}

Solution 46 - Ios

I had the same issue for the simulator/SwiftUI preview with the following warnings:

> ld: warning: ignoring file Pods/.../X.xcframework/ios-arm64_armv7/X.xcframework/X, missing required architecture x86_64 in file Ignoring file Pods/.../X.xcframework/ios-arm64_armv7/X.xcframework/X (2 slices)

I had recursive path $(SRCROOT) in the Framework Search Path in my project settings. After removing it, the project built without the error.

Solution 47 - Ios

In our case it was an error in a Jenkins build:

> Frameworks/release' > xxx/Library/Developer/Xcode/DerivedData/xxx-cuytrcyjdlfetmavpdonsknoypgk/Build/Products/Debug-iphoneos/AppsFlyerLib.framework/AppsFlyerLib(AFSDKDevice.o), > building for iOS, but linking in object file built for Mac Catalyst, > file > 'xxx/Library/Developer/Xcode/DerivedData/xxx-cuytrcyjdlfetmavpdonsknoypgk/Build/Products/Debug-iphoneos/AppsFlyerLib.framework/AppsFlyerLib' > for architecture arm64

We fixed it with sudo gem update cocoapods.

Solution 48 - Ios

I got the same error after switching to Macbook Pro M1 App Silicon. Solution that worked for me:

  • delete the Podfile.lock
  • run pod install that's it.

Solution 49 - Ios

Xcode Version 13.2.1 and macOS Monterey 12.0.1

Almost everybody is facing the same issue with old projects and pods after switching to new M1 chip system.

> "in /Users//Desktop/_iOS_app/Pods/iOS/framework/(CLSInternalReport.o), > building for iOS Simulator, but linking in object file built for iOS, > file '/Users/y/Desktop/_iOS_app/Pods/iOS/.framework/for architecture > arm64"

I have come to a solution which is working perfectly.

First thing first, to all the developer who are suggesting exclude arm64 for your project will work yes it will compile but after installation when you try to open it, it will show a popup with the message, "the developer of this App needs to be update it to work with this version of iOS". This is because as per apple "In iOS 11 and later, all apps use the 64-bit architecture" and if you exclude arm64 for your project it will not open App on iOS 11 and later.

App will not open in iOS 11 and later if exclude arm64 and will show this popup

So instead of selecting whole project only excluded architectures for the simulator to arm64.

Steps: On top of project files, Select target > build setting > architecture > excluded architecture. now add select "any iOS simulator SDK" and give it a value arm64.

See the image below for refrence.

only select

Solution 50 - Ios

In my case it's working 100%. Try this:

I have a temporary solution.

You just follow the image.

  • Double click architecture and select Other and Remove all lines

  • Add two things arm7s and arm7

  • Run your physical device on the iPhone, not the simulator

  • Enjoy...

Example image

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionbtxiosView Question on Stackoverflow
Solution 1 - IosAmit SamantView Answer on Stackoverflow
Solution 2 - IosAyan SenguptaView Answer on Stackoverflow
Solution 3 - IosSlashDevSlashGnollView Answer on Stackoverflow
Solution 4 - IosTony ArnoldView Answer on Stackoverflow
Solution 5 - IostrishcodeView Answer on Stackoverflow
Solution 6 - IosRunesReaderView Answer on Stackoverflow
Solution 7 - IosTomas WardView Answer on Stackoverflow
Solution 8 - IosOmerTurhnView Answer on Stackoverflow
Solution 9 - Ios8HP8View Answer on Stackoverflow
Solution 10 - IosRaghavView Answer on Stackoverflow
Solution 11 - IosprogrammerView Answer on Stackoverflow
Solution 12 - IosBosco DomingoView Answer on Stackoverflow
Solution 13 - IosVaderView Answer on Stackoverflow
Solution 14 - IosMedhiView Answer on Stackoverflow
Solution 15 - IosNavigatorView Answer on Stackoverflow
Solution 16 - IosSleepyCatZzView Answer on Stackoverflow
Solution 17 - IosPratik SodhaView Answer on Stackoverflow
Solution 18 - Iosinder_gtView Answer on Stackoverflow
Solution 19 - IosbtxiosView Answer on Stackoverflow
Solution 20 - IoswillhessView Answer on Stackoverflow
Solution 21 - IosRaphael PayetView Answer on Stackoverflow
Solution 22 - Iosjiawei wangView Answer on Stackoverflow
Solution 23 - IosvidalbenjoeView Answer on Stackoverflow
Solution 24 - IosYazanGhafirView Answer on Stackoverflow
Solution 25 - IosHassanView Answer on Stackoverflow
Solution 26 - Iosuser4478383View Answer on Stackoverflow
Solution 27 - IosSunil TargeView Answer on Stackoverflow
Solution 28 - IosYanXing OuView Answer on Stackoverflow
Solution 29 - IosrexshengView Answer on Stackoverflow
Solution 30 - IosGokul GView Answer on Stackoverflow
Solution 31 - IosNikaanerView Answer on Stackoverflow
Solution 32 - IosBigStView Answer on Stackoverflow
Solution 33 - IosCuong LamView Answer on Stackoverflow
Solution 34 - IosMr BView Answer on Stackoverflow
Solution 35 - IosSahil OmerView Answer on Stackoverflow
Solution 36 - Iosuser10224777View Answer on Stackoverflow
Solution 37 - IosCosminView Answer on Stackoverflow
Solution 38 - Iosmitchy_devView Answer on Stackoverflow
Solution 39 - IosAravindView Answer on Stackoverflow
Solution 40 - IosTran Anh KhoaView Answer on Stackoverflow
Solution 41 - IosSohaib AslamView Answer on Stackoverflow
Solution 42 - IosDaemonson DongView Answer on Stackoverflow
Solution 43 - IosRudolf KopřivaView Answer on Stackoverflow
Solution 44 - IosHarryView Answer on Stackoverflow
Solution 45 - Iosuser2978589View Answer on Stackoverflow
Solution 46 - IosTibidaboView Answer on Stackoverflow
Solution 47 - IosNike KovView Answer on Stackoverflow
Solution 48 - IosMiniappsView Answer on Stackoverflow
Solution 49 - Iosazeem usmaniView Answer on Stackoverflow
Solution 50 - Iosuser15554941View Answer on Stackoverflow