How to use @compatibility_alias to alias classes for previous versions of iOS

后端 未结 1 1559
终归单人心
终归单人心 2021-01-03 08:39

Can somebody tell me how to use @compatibility_alias to take a class, for example, UIActivityViewController, that is new to iOS 6, and use @compatibility_alias to make it wo

相关标签:
1条回答
  • 2021-01-03 09:27

    It is just an alias of method names, nothing more.

    It is a feature of the Objective-C compiler rather than of the runtime

    Looking at NSHipster we see:
    @compatibility_alias: Allows existing classes to be aliased by a different name.
    This allows one to write their own implementation of a class that is not available in the current SDK and "alias" the name to that of the class in the newer sdk. So, the key is to write or find another class that has the same methods and behaviors of another unavailable class.

    There is no magic bullet here.

    As an aside: I used to have to stand in line in the Post Office and there was a sign that said: "If it seems to good to be true, it probably is", that applies here.

    See NSHipster, search for @compatibility_alias.

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