Closed gr4yscale closed 8 years ago
The library never used the code in the link. The link is only there to show all possible values, which are nicely listed on that page. I'll change the readme so that the link automatically shows the relevant lines.
I'll close the issue, but if you feel like this should be handled in another way, please reopen.
UIDevice does not provide values like those listed in the example you showed, it gives more generic things like "iPhone" or "iPod touch". See here:
When I used this on my 6+ I got simply "iPhone" which is not specific enough, and is not in the example list that you link to in the readme.
To get the specific models then you will have to use the sysctl framework, which many people have made categories and wrappers for.
Do you have plans to update this, or should I do it myself?
It has been a while since I implemented / wrapped the UIDevice class, I will look into this issue, I believe you should simply have to change the model variable with this...
#import <sys/utsname.h>
struct utsname systemInfo;
uname(&systemInfo);
NSString *model = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
This should return more specific device types, I sadly haven't the time right now to properly implement or test, but you could give that a try, I will look into updating this soon.
Actually this has been solved here #21 - will update the README to reflect these changes.
If @GertjanReynaert could update the NPM to.
This library uses UIDevice calls now, not this:
https://github.com/InderKumarRathore/DeviceUtil/blob/master/DeviceUtil.m
...that was confusing, can you please update the readme?