How to detect & avoid the use of private APIs in third party libraries

前端 未结 2 998
花落未央
花落未央 2020-12-28 10:15

Now that Apple is running some kind of static analysis to automatically check for private API use, a number of people have been caught because of the Three20 library. I use

相关标签:
2条回答
  • 2020-12-28 10:26

    You could try running nm on the object files instead of the linked executable:

    nm -g -j *.o  | sort | uniq
    

    The objects should be in the build/<app>.build/*/<app>.build/Objects-normal sub-directory.

    You're seeing a reference to AudioServicesPlaySystemSound because one of the functions you did call in turn calls AudioServicesPlaySystemSound.

    Objective C calls won't generally show up in nm dumps, you'll need to use otool for that:

    otool -ov <object file>
    
    0 讨论(0)
  • 2020-12-28 10:26

    Use this dev tool, App Scanner. It scans your .app file for private API methods. A future release will also check for private API instance variables.

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