Check iOS deployment target of a static library

后端 未结 3 977
太阳男子
太阳男子 2021-02-08 06:08

I have many static libs like libBlah.a With file tool I can check supported architectures. (arm64 or i386)

Is there tool to check iOS Dep

相关标签:
3条回答
  • 2021-02-08 06:40

    The target OS version is encoded in the LC_VERSION_MIN_IPHONEOS load command in the MachO header of the static library. You can see it via:

    otool -l mylib.a | grep -A 3 LC_VERSION
    

    Example output:

          cmd LC_VERSION_MIN_IPHONEOS
      cmdsize 16
      version 9.0
          sdk n/a
    
    0 讨论(0)
  • 2021-02-08 06:41

    have you tried using preprocess macros?

    #if IPHONEOS_DEPLOYMENT_TARGET (iOS Deployment Target)
    
    0 讨论(0)
  • 2021-02-08 06:53

    You can use otool to inspect the library file. With some experimentation I found that the flags -lv gave me useful output. Open up a terminal window and switch to the directory your library is in:

    cd /path/to/parent/directory
    

    (Hint: you can drag the icon from the title bar of a finder window into the terminal and it will enter the path for you). Then type the following command:

    otool -lv myStaticLibrary.a | less
    

    In less, type / (search) and then LC_VERSION_MIN_IPHONEOS. You should see something like this:

    Load command 1
          cmd LC_VERSION_MIN_IPHONEOS
      cmdsize 16
      version 7.0
          sdk n/a
    

    The deployment target should be the value next to version.

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