设为首页收藏本站
查看: 287|回复: 0

[问答求助] 环信HyphenateLite.framework上传appstore contains unsupported architectures ‘...

[复制链接]

75

主题

75

帖子

442

积分

网站编辑

Rank: 8Rank: 8

积分
442
发表于 2017-6-15 16:29:15 | 显示全部楼层 |阅读模式
在Xcode中从动态库剥离不需要的架构
自从iOS 8发布以来,开发人员已经能够利用动态库对iOS开发的好处。对于一般开发,为所有需要的架构设置一个单一的动态库是非常好的,所以您可以在所有设备和iOS模拟器上运行,而无需更改任何东西。然而,这种方法有一个缺点 - 因为它们在运行时链接,当一个动态库被单独编译到最终应用程序时,不可能知道实际需要哪些架构。因此,Xcode将在编译时将整个事物复制到应用程序包中。除了浪费的磁盘空间,理论上没有真正的缺点。但是实际上,iTunes Connect不喜欢我们添加未使用的二进制切片:这时候,打包上传Appstore会报如下错误:

那么,我们如何解决这个问题呢?
步骤如下:

在Build Phases中加入run script。在里面添加Shell脚本,
  1. APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
  2. find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
  3. do
  4.   FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
  5.   FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"   
  6.   echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"

  7.    EXTRACTED_ARCHS=()

  8.   for ARCH in $ARCHS
  9.   do
  10.     echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
  11.     lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
  12.     EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
  13. done

  14. echo "Merging extracted architectures: ${ARCHS}"
  15. lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
  16. rm "${EXTRACTED_ARCHS[@]}"

  17. echo "Replacing original executable with thinned version"
  18. rm "$FRAMEWORK_EXECUTABLE_PATH"
  19. mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"
  20. done
复制代码
该脚本将查看您构建的应用程序的Frameworks文件夹,并确保只有您正在构建的架构存在于每个框架中。
好多了!现在我可以在我的项目中添加包含我所需要的所有架构的胖动态库,而我的构建过程将会在任何给定的时刻处理哪些架构。

可解决环信HyphenateLite.framework上传appstore报错:
在使用环信HyphenateLite.framework时,出现如下错误:
  1. Code1:ERROR ITMS-90087: "Unsupported Architectures.

  2. The executable for MM_FESCO.app/Frameworks/HyphenateLite.framework

  3. contains unsupported architectures '[x86_64, i386]'."
  4. ERROR ITMS-90087: "Unsupported Architectures.

  5. The executable for MM_FESCO.app/Frameworks/HyphenateLite.framework

  6. contains unsupported architectures '[x86_64, i386]'."
  7. Code2:ERROR ITMS-90209: "Invalid Segment Alignment.

  8. The app binary at 'MM_FESCO.app/Frameworks/HyphenateLite.framework/HyphenateLite'

  9. does not have proper segment alignment. Try rebuilding the app with the latest Xcode version."
  10. ERROR ITMS-90209: "Invalid Segment Alignment.

  11. The app binary at 'MM_FESCO.app/Frameworks/HyphenateLite.framework/HyphenateLite'

  12. does not have proper segment alignment. Try rebuilding the app with the latest Xcode version."
  13. Code3: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."
  14. ERROR ITMS-90125: "The binary is invalid.

  15. The encryption info in the LC_ENCRYPTION_INFO load command is either missing or invalid,

  16. or the binary is already encrypted.

  17. This binary does not seem to have been built with Apple's linker."
  18. Code4:WARNING ITMS-90080: "The executable 'Payload/MM_FESCO.app/Frameworks/HyphenateLite.framework'

  19. is not a Position Independent Executable. Please ensure that your build settings are configured to create PIE executables.

  20. For more information refer to Technical Q&A QA1788 - Building a Position Independent Executable in the iOS Developer Library."
  21. WARNING ITMS-90080: "The executable 'Payload/MM_FESCO.app/Frameworks/HyphenateLite.framework'

  22. is not a Position Independent Executable.

  23. Please ensure that your build settings are configured to create PIE executables.

  24. For more information refer to Technical Q&A QA1788 -

  25. Building a Position Independent Executable in the iOS Developer Library."
复制代码


回复

使用道具 举报

*滑动验证:
您需要登录后才可以回帖 登录 | 加入社区

本版积分规则

推荐阅读 More>
广告位

Powered by Discuz X3.2

© 2001-2016   

合作伙伴

返回顶部 返回列表