Mac App Store: Giving up 32 bit support in favor for ARC, will existing users of 32 bit version see an update message?

醉酒当歌 提交于 2019-12-03 17:23:28

I've also found out that ARC requires 64bit processors. However, I managed to build a fat binary where the 64bit version uses ARC and the 32bit version uses the garbage collector. To do this I had to do the following:

  • set up a 32bit only target that uses GC
  • set up a 64bit only target that uses ARC
  • add the 32bit target as a dependency to the 64bit target
  • add a custom build phase with a shell script that uses lipo to assemble a fat binary from the binaries in the two targets

Both targets use the same source, but a few #ifdef __OBJC_GC__ statements were necessary. I did have to give up synthesized ivars for backward compatibility :(

I don't know what App Store will do (and it's probably subject to change, anyway), but if the app does get delivered to 32-bit customers, you can work around the problem in this way:

  1. Make your app 64-bit only.
  2. Make a second app that is 32-bit only and does nothing but show an alert message.
  3. Build all of the resources from the second app into the first (i.e., add them to both targets).
  4. Make the second target a dependency of the first, and use lipo in a shell script phase in the first target to assimilate the 32-bit binary into the 64-bit binary.

You'll then have a Universal Binary (or “fat binary”) that is your real application on 64-bit machines, and the “please upgrade your Mac” application on 32-bit machines.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!