解决xcode和App Store报错

解决xcode和App Store报错

参考资料:ios

Xcode 10 Error: Multiple commands produce

使用xcode10编译项目报错web

error: Multiple commands produce '/Users/xiaoyuan/Library/Developer/Xcode/DerivedData/Boobuz-gnxeuntgkenwgdgycqnvabqubafh/Build/Products/Debug-iphoneos/Boobuz.app':
1) Target 'Boobuz' has create directory command with output '/Users/xiaoyuan/Library/Developer/Xcode/DerivedData/Boobuz-gnxeuntgkenwgdgycqnvabqubafh/Build/Products/Debug-iphoneos/Boobuz.app'
2) That command depends on command in Target 'Boobuz': script phase “[CP] Copy Pods Resources”

缘由是Xcode 10 默认使用的build system是New build system,与Xcode9不一样致使。xcode

解决方法:修改build systembash

在Xcode菜单栏 -> File -> Workspace Setting,将build system修改成legacy build system,而后clean后编译。
架构

App Store提交审核报错 ERROR ITMS-90087

报错信息app

ERROR ITMS-90087: "Unsupported Architectures. The executable for yht.temp_caseinsensitive_rename.app/Frameworks/VideoCore.framework contains unsupported architectures '[x86_64, i386]'."  

ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at 'yht.temp_caseinsensitive_rename.app/Frameworks/VideoCore.framework/VideoCore' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version."  
      
ERROR ITMS-90125: "The binary is invalid. The encryption info in the LC_ENCRYPTION_INFO load command is either missing or invalid, or the binary is already encrypted. This binary does not seem to have been built with Apple's linker."  
      
WARNING ITMS-90080: "The executable 'Payload/yht.temp_caseinsensitive_rename.app/Frameworks/VideoCore.framework' is not a Position Independent Executable. Please ensure that your build settings are configured to create PIE executables. For more information refer to Technical Q&A QA1788 - Building a Position Independent Executable in the iOS Developer Library."

AppStore不容许SDK里面包含了x86_64, i386 架构的,全部会在上传的时候报错,解决办法就是要这个SDK剔除掉x86_64, i386这两个架构iphone

解决办法: TARGETS->Build Phases->点击加号选择New Run Script Phase->而后复制粘贴下面代码ide

APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"  
      
    # This script loops through the frameworks embedded in the application and  
    # removes unused architectures.  
    find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK  
    do  
    FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)  
    FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"  
    echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"  
      
    EXTRACTED_ARCHS=()  
      
    for ARCH in $ARCHS  
    do  
    echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"  
    lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"  
    EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")  
    done  
      
    echo "Merging extracted architectures: ${ARCHS}"  
    lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"  
    rm "${EXTRACTED_ARCHS[@]}"  
      
    echo "Replacing original executable with thinned version"  
    rm "$FRAMEWORK_EXECUTABLE_PATH"  
    mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"  
      
    done

ERROR ITMS-90206:“Invalid Bundle. The bundle at ‘XXX.appex’ contains disallowed file ‘Frameworks’.”

当咱们上传咱们的包到AppStore的时,有时候会报出错误:ERROR ITMS-90206:"Invalid Bundle. The bundle at 'XXX.appex' contains disallowed file 'Frameworks'."svg

发生错误的缘由:咱们使用了ios的extension扩展插件,好比today-widget,或者是AppWatch等。oop

首先进入项目Build Setting

  • For main project: Embedded Content Contains
    Swift Code to Yes

  • Custom Framework: Embedded Content Contains Swift Code to No

  • Custom Framework: Runpath Search Path = @executable_path/…/…/Frameworks

尝试是否OK,通常状况下会OK的,若是还不行的话,继续下面的操做

进入到扩展插件下->Build Phases 点击添加按钮,选择New Run Script Phase,而后将加入下面代码:

cd "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/"
if [[ -d "Frameworks" ]]; then 
   rm -fr Frameworks
fi

上面的脚本会把扩展插件依赖的framework给删除。

能够尝试修改扩展插件对framework的文件的依赖,将framework的文件抽取出来,就想日常的文件那样引用。

CFBundleVersion Mismatch

缘由是today extension的应用和主APP的版本和构建版本不一致,二者维护成一致的就没有这个问题了。