How to figure out the app ID programmatically at runtime?

后端 未结 4 1935
刺人心
刺人心 2021-02-14 09:12

Is there a way to do that? I would hate it to hard-code the app ID somewhere...

4条回答
  •  失恋的感觉
    2021-02-14 09:34

    If you mean your com.whatever.whatever identification:

    NSString *myAppID = [[NSBundle mainBundle] bundleIdentifier];
    

    If you mean your iTunes id123456789 identification, it's not available to you at runtime, but is given to you on iTunes Connect and can be manually inserted into your app from there.

提交回复
热议问题