Getting an iPhone app's product name at runtime?

前端 未结 12 2195
醉梦人生
醉梦人生 2021-01-30 19:43

How can this be achieved? I would like to get the name so i can display it within an app, without having to change it in code each time i change a name, of course.

12条回答
  •  故里飘歌
    2021-01-30 20:06

    This is just a swift update for this very old question. I was in need of swift answer and it was kind of tricky(Unwrapping optionals) in swift syntax so sharing it here

    let productName = NSBundle.mainBundle().infoDictionary!["CFBundleName"]!
    

提交回复
热议问题