What is the preprocessor macro to test whether an application extension is being built?

前端 未结 3 1547
日久生厌
日久生厌 2021-02-04 06:18

This question is based purely on publicly released documents regarding the introduction of application extensions in iOS.

With the introduction of app extensions in iOS

3条回答
  •  孤城傲影
    2021-02-04 06:35

    You can use the same technique than Apple uses for raising the compilation error.

    #if !(defined(__has_feature) && __has_feature(attribute_availability_app_extension))
      //Not in the extension
    #else
      //In extension
    #end
    

提交回复
热议问题