skip to Main Content

I am using Alamofire in my app and I would like to print the version number to the logs during app start. Is there a way to access the version number programatically?

2

Answers


  1. May be there is a short way but you can use this

    print(Bundle(identifier: "org.cocoapods.Alamofire")!.infoDictionary!["CFBundleShortVersionString"] as! String)
    
    Login or Signup to reply.
  2. Alamofire’s version is part of its default User-Agent header, so if you’re logging your network request, the version should be part of that already. I can see that it could be useful for it to be public so it can be part of custom logging or other headers, so I’ll look into making it public.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search