Total RAM size of an iOS device
The simplest solution to find total RAM in a device is to use NSProcessInfo
:
Objective C:
[NSProcessInfo processInfo].physicalMemory
Swift 3:
NSProcessInfo.processInfo().physicalMemory
Swift 5:
ProcessInfo.processInfo.physicalMemory
Note: physicalMemory
gives us the information at bytes, to calculate GB, divide by the constant 1073741824
.
As documented here.
Slight change for Swift 3:
ProcessInfo.processInfo.physicalMemory