Objective C Macro append to string

后端 未结 3 1552
隐瞒了意图╮
隐瞒了意图╮ 2021-01-25 12:58

I think this is a very simple thing to do, but since I\'m new to iOS development and objective C, I can\'t figure it out.

#define RESTFUL_PATH_PREFIX @\"https://         


        
3条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-25 13:27

    It is much better practice to use constants instead of define macros.

    static NSString *const YourPath = @"https://...";
    

    And then you can concatenate your strings with NSString stringWithFormat: method.

提交回复
热议问题