krikor Herlopian krikor Herlopian - 4 years ago 148
iOS Question

How to get Defaut User Agent to send to server side in the header

In swift 3, am using Alamofire library.I want to get the default user agent , that is like operating system (ios 10) and etc info.
How can I do this? Thank you

Answer Source

Use UIDevice to get system info in iOS.

[[UIDevice currentDevice] systemName]; // e.g. @"iOS"
[[UIDevice currentDevice] systemVersion]; // e.g. @"10.0"
[[UIDevice currentDevice] model]; // e.g. @"iPhone", @"iPod touch"
[[UIDevice currentDevice] localizedModel]; // localized version of model
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download