简体   繁体   中英

Only link third party framework on device

I'm using a third party Objective-C framework in my project. This framework is only supported on devices, but not the simulator. How can I still compile my project for the simulator and just not use that framework, to be able to test the rest of the app?

You can use your framework with macro TARGET_IPHONE_SIMULATOR . Something like:

#if TARGET_IPHONE_SIMULATOR
    //  do not import the framework
#else
    //  import the framework and use it
#endif

EDIT:

You can optionally link the framework/library by settings given below:

  • If the third-party is a library (a file with extension .a ), then use this:

    链接库

    and make sure path for your library is included in the Library Search Paths for related configuration.

  • If it is a framework (a folder with extension .framework ), then use this:

    链接框架

    and make sure path for your framework is included in the Framework Search Paths for related configuration.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM