Could not find module for target 'x86_64-apple-ios-simulator'

前端 未结 6 3067
小鲜肉
小鲜肉 2020-12-13 09:59

I have my custom framework and it works properly in XCode 10. I rebuild it in XCode 11 beta 3, then integrated into the app, and get the following error:

Could not f

相关标签:
6条回答
  • 2020-12-13 10:03

    To solve this issue I had to create a fat library of my custom framework again using xcode 11 tools.

    To do that I did the following:

    1) Build YourCustomFramework target for iOS simulator and extract framework from products folder on your desktop.

    Xcode⁩ ▸ ⁨DerivedData⁩ ▸ ⁨Your Project ▸ ⁨Build⁩ ▸ ⁨Products⁩ ▸ ⁨Release-iphonesimulator

    2) Build YourCustomFramework target for Generic iOS Device and extract framework from products folder on your desktop.

    Xcode⁩ ▸ ⁨DerivedData⁩ ▸ ⁨Your Project ▸ ⁨Build⁩ ▸ ⁨Products⁩ ▸ ⁨Release-iphoneos⁩

    3) Rename the simulator generated framework to YourCustomFramework-sim.framework so that it is distinguishable later.

    4) Use the lipo command to combine both binaries into a single fat binary file. (cd to your desktop or wherever your custom framework file is located)

    $lipo -create ./YourCustomFramework-sim.framework/YourCustomFramework ./YourCustomFramework.framework/YourCustomFramework -output ./YourCustomFramework
    

    5) Copy YourCustomFramework binary file created in above step and replace it with the binary in YourCustomFramework.framework folder.

    6) From folder

    YourCustomFramework-sim.framework/Modules/YourCustomFramework.swiftmodule/
    

    copy all of the modules and paste them to

    YourCustomFramework.framework/Modules/YourCustomFramework.swiftmodule/
    

    This should solve your issue.

    0 讨论(0)
  • 2020-12-13 10:19

    If you want to automate the process for your project you can try the script below that I use in my framework projects.

    It works for both Objective-C and the Swift projects. I tested on iOS and tvOS too.

    For more detail and updates please follow my repo page.

    Script

    #!/bin/sh
    
    ######################
    # Globals
    ######################
    
    # Avilable Platforms/Architectures 
    # macosx | iphoneos | iphonesimulator | appletvos | appletvsimulator | watchos | watchsimulator
    DEVICE_ARCH="iphoneos"
    DEVICE_SIM_ARCH="iphonesimulator"
    
    FRAMEWORK_NAME="${PROJECT_NAME}"
    DEVICE_LIBRARY_PATH=${BUILD_DIR}/${CONFIGURATION}-${DEVICE_ARCH}/${FRAMEWORK_NAME}.framework
    SIMULATOR_LIBRARY_PATH=${BUILD_DIR}/${CONFIGURATION}-${DEVICE_SIM_ARCH}/${FRAMEWORK_NAME}.framework
    UNIVERSAL_LIBRARY_DIR=${BUILD_DIR}/${CONFIGURATION}-Universal
    SUCCESS=true
    EXIT_MESSAGE=$?
    ROW_STRING="\n##################################################################\n"
    
    echoPaths() 
    {
        echo "${ROW_STRING}"
        echo "DEVICE_LIBRARY_PATH: ${DEVICE_LIBRARY_PATH}"
        echo "SIMULATOR_LIBRARY_PATH: ${SIMULATOR_LIBRARY_PATH}"
        echo "UNIVERSAL_LIBRARY_DIR: ${UNIVERSAL_LIBRARY_DIR}"
        echo "${ROW_STRING}"
    }
    
    checkSuccess()
    {
        if [[ -z $EXIT_MESSAGE ]]; then
            SUCCESS=false
            exitWithMessage
            exit 1
        fi
    }
    
    exitWithMessage() 
    {
        echo "${ROW_STRING}"
    
        if [ "$SUCCESS" = true ] ; then
            echo "\n\n\n                                                                     
    0 讨论(0)
  • 2020-12-13 10:20

    Please check your Scheme be sure to run correct scheme.

    And then you should open XCode > -Your Main Target- > Build Active Architecture Only and set 'NO' to build on the all architectures.

    Options:

    YES - If set to yes, then Xcode will detect the device that is connected, and determine the architecture, and build on just that architecture alone.

    NO - If set to no, then it will build on all the architectures.

    0 讨论(0)
  • 2020-12-13 10:20

    For me it was a setting missing. In Xcode go to: File->Workspace Settings . In Build System change it to "Legacy Build system".

    Run it again and copy the new Framework

    0 讨论(0)
  • 2020-12-13 10:25

    I have added two architectures i386 and x86_64. And set Yes to "Build Active Architecture Only". It works for me to build on every simulator devices.

    For the XCode-12 Valid Architectures has been moved under User-Defined option at the very bottom as VALID_ARCHS

    0 讨论(0)
  • 2020-12-13 10:27

    Swift 5.0-5.1, Xcode 11
    Open Xcode, <your project>, Build Settings, Build Active Architecture Only and change to <NO> for Debug and Release. Architectures set/leave in Standard Architecture -$(ARCHS_STANDARD), important is next step:
    Valid Architecture: armv7, armv7s, arm64, arm64e, ADD here x86_64 and if you need add i386 for Debug and Release. (String: armv7, armv7s, arm64, arm64e, x86_64)

    Choose any simulator in your simulator list and BUILT IT. DONE. 

    I hope it is works for you.


    Description of Architecture:

    armv64: iPhoneX, iPhone 5s-8, iPad Air — iPad Pro

    armv7 : iPhone3Gs-5c, iPad WIFI(4th gen)

    armv6 : iPhone — iPhone3G

    -the above if for real devices

    i386 : 32-bit simulator

    x86_64 : 64-bit simulator

    0 讨论(0)
提交回复
热议问题