如果新增Target在同一專案下可利用以下方式來區隔Target,避免需要維護兩份Code的成本
選擇 target -> Build Settings -> 搜尋 "preprocessor Macros"

完成後在需要判斷是否為pro或lite版本方式
選擇 target -> Build Settings -> 搜尋 "preprocessor Macros"

*此範例為新增一個lite的版本
*Debug & Release 兩個版本都要加入
完成後在需要判斷是否為pro或lite版本方式
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef LITE | |
//lite version | |
//your code here | |
#else | |
//not lite version(i.e. pro) | |
//your code here | |
#endif | |
//------------------------------------------------------------- | |
#ifndef PRO | |
//is pro version | |
//your code here | |
#else | |
//not pro version(i.e. lite) | |
//your code here | |
#endif |
沒有留言:
張貼留言