inderkumarrathore / deviceutil Goto Github PK
View Code? Open in Web Editor NEWFor Swift please visit DeviceGuru(https://github.com/InderKumarRathore/DeviceGuru)
License: MIT License
For Swift please visit DeviceGuru(https://github.com/InderKumarRathore/DeviceGuru)
License: MIT License
We have a 1TB 12.9 WIFI model in the office, and it has the id iPad8,6
. This lines up with theiphonewiki
DEviceUtil.h without iPhone11_6 const
According to this the "XS Max" will have the identifier iPhone11,6
and the "XR" will have iPhone11,8
. I am not sure what the regular "XS" will have as it's identifier.
The readme says to use
DeviceUtil *deviceUtil = [[DeviceUtil alloc] init]; [deviceUtil hardwareString] == IPHONE_5
to check the device type.
In 6.0.1 the hardware method has disappeared. Is that a mistake, or should this be used in a different way now?
I just write log message here
`This is a device which is not listed in this category. Please visit https://github.com/InderKumarRathore/DeviceUtil and add a comment there.
Your device hardware string is: iPad14,3`
please listup this iPad model. thanks
This may not be feasible, but it would be nice if DeviceUtil could report the macOS system and device info for iOS apps that are running on Apple Silicon Macs. Currently, when the iOS app is run on an Apple Silicon Mac, DeviceUtil returns: iPad8,6 - iPad Pro 12.9-Inch 1TB (Wi-Fi Only - 3rd Gen).
In the version 1.2.2 there was in DeviceUtil class the method hardwareSimpleDescription that is really useful to have a less detailed hardware description if compared to harwareDescription method.
Hello,
This is de message:
This is a device which is not listed in this category. Please visit https://github.com/inderkumarrathore/UIDevice-Hardware and add a comment there.
Your device hardware string is: iPhone7,1
Thank you.
The iPhone 6s is listed in the README.md document as "iPhone8,2". I think that should be "iPhone8,1".
These macros are not correct because the UIDevice instance does not has hardware
property.
DEVICE_HARDWARE_BETTER_THAN
IS_IPHONE_5
IS_SIMULATOR
IS_IPHONE_6
IS_IPHONE_6_PLUS
Just wondering if the Pod will be updated to include the iPhone12
Hi guys, im getting this error when running on ipad, 7th generation
Your device hardware string is: iPad7,12
2020-03-09 11:11:15.495057+0100 Universal[52616:2561872] This is a device which is not listed in this category. Please visit https://github.com/InderKumarRathore/DeviceUtil and add a comment there
I will be appreciate that if you can support arc.
Please add iPad 5th generation(Model A1822) to DeviceUtil.plist, enumeration and constants.
Thank you!
Support for the new iPhones is missing.
Please add.
It shouldn't be difficult to make this available via Swift Package Manager
I Added this to the .m file
+ (BOOL)hasNativeGPS {
switch ([self hardware]) {
case IPHONE_3G:
case IPHONE_3GS:
case IPHONE_4:
case IPHONE_4_CDMA:
case IPAD_4_GSM_CDMA:
case IPHONE_4S:
case IPHONE_5:
case IPHONE_5_CDMA_GSM:
case IPHONE_5C:
case IPHONE_5C_CDMA_GSM:
case IPHONE_6:
case IPHONE_6_PLUS:
case IPHONE_6S:
case IPHONE_6S_PLUS:
case IPAD_2:
case IPAD_2_CDMA:
case IPAD_MINI:
case IPAD_MINI_WIFI_CDMA:
case IPAD_AIR_2_WIFI_CELLULAR:
case IPAD_PRO_97_WIFI_CELLULAR:
return YES;
break;
case IPHONE_2G:
case IPAD_3_WIFI:
case IPAD_4_WIFI:
case IPAD_AIR_2_WIFI:
case IPOD_TOUCH_4G:
case IPOD_TOUCH_5G:
case IPAD_2_WIFI:
case IPAD_MINI_WIFI:
case IPAD_PRO_97_WIFI:
return NO;
break;
default:
// this is tricky!
NSLog(@"We have no information for your device's GPS capabilities listed in this category.");
NSLog(@"Your device is: %@", [self hardwareDescription]);
}
return YES;
}
and this to the header:
/** This method returns a BOOL stating if the device has GPS capabilities. This does know of external (Bluetooth) devices connected to the device. **/
+ (BOOL)hasNativeGPS;
OC版本怎么没有添加最新的设备(iPhone7 & iPhone7 Plus)?Swift版本貌似添加了?
As per the accompanying NSLog statement, I am posting this comment...
When run on an iPad Air (hardware 'iPad4,2'), the hardwareDescription method returns an empty string. I assume that this code does not yet support iPad Air or mini with retina.
Here's code to support the new devices:
// support for iPad Air and mini retina
if ([hardware isEqualToString:@"iPad4,1"]) return @"iPad Air (WiFi)";
if ([hardware isEqualToString:@"iPad4,2"]) return @"iPad Air (GSM)";
if ([hardware isEqualToString:@"iPad4,3"]) return @"iPad Air (CDMA)";
if ([hardware isEqualToString:@"iPad4,4"]) return @"iPad Mini Retina (WiFi)"; // unconfirmed
if ([hardware isEqualToString:@"iPad4,5"]) return @"iPad Mini Retina (Cellular)"; // unconfirmed
Suggestion: instead of just returning an empty string for unknown devices, would it make sense to at least return the generic device type? In other words, since we know that the hardware is "iPad4,2" couldn't the hardwareDescription method return "iPad" in this case?
// return generic strings for unknown devices
if ([hardware hasPrefix:@"iPhone"]) return @"iPhone";
if ([hardware hasPrefix:@"iPod"]) return @"iPod";
if ([hardware hasPrefix:@"iPad"]) return @"iPad";
Is there a reason origin/HEAD origin/master isn't set to the latest (tag 2.0.3)?
At the beginning of
- (Hardware)hardware {
this is called:
NSString *hardware = [self hardwareString];
But since commit fa656df this will never return i386_Sim
or x86_64_Sim
.
Thus
if ([hardware isEqualToString:i386_Sim]) return SIMULATOR;
if ([hardware isEqualToString:x86_64_Sim]) return SIMULATOR;
will never happen.
Or am I missing something?
Did anyone find the new 2019 device identifiers?
https://everymac.com/ultimate-mac-lookup/?search_keywords=Pending
hi there!
Your iphone 6 / 6 plus strings are matched incorrectly in
The hardware string for iPhone 6 is actually "iPhone7,2" and for iPhone 6 Plus it's "iPhone7,1"
Also, the hardware is returned as IPHONE_6_PLUS for both 6 & 6 Plus hardware strings
I've been using you category for some time and thought I'd share before too much damage is done elsewhere :)
cheers
Please push updated version with tvos support to cocoapods.
I'm trying to develop for different devices and use the simulator to test my changes.
Will the DeviceUtil return simulator and the device ?
If it just returns simulator this isn't very useful.
On iOS, the UI prefix is reserved for UIKit. To prevent naming conflicts, applications should not use this prefix. (e.g. a future release of iOS may ship with a class called UIDeviceUtil.)
The cocoa pods spec repo is out of date: https://github.com/CocoaPods/Specs/blob/master/Specs/UIDeviceUtil/1.1.2/UIDeviceUtil.podspec.json
Hello,
I just updated from an earlier version (1.2.2) and noticed an occasional crash.
The reason is an empty (not nil) deviceList. I haven't found the actual cause yet.
DeviceUtil 1.3.1
iOS 9.1
2015-11-19 10:04:07.075 Salesmapp[7206:107309] -[**NSCFString objectForKey:]: unrecognized selector sent to instance 0x7fb6897897e0
2015-11-19 10:04:07.079 Salesmapp[7206:107309] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString objectForKey:]: unrecognized selector sent to instance 0x7fb6897897e0'
* First throw call stack:
(
0 CoreFoundation 0x000000010a61ac65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010a2b3bb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010a6220ad -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010a57813c __forwarding + 988
4 CoreFoundation 0x000000010a577cd8 _CF_forwarding_prep_0 + 120
5 App 0x0000000103da7b52 +[DeviceUtil hardwareDescription] + 98
Is there any reason why the entry has 1.1000000000000001 instead of just 1.1 ?
<dict>
<key>name</key>
<string>Apple TV 1G</string>
<key>version</key>
<real>1.1000000000000001</real>
</dict>
When using use_frameworks!
the plist is not included for some reason .. so the app stops at:
NSAssert(deviceList != nil, @"Please either use cocoapod for this library or include DeviceList.plist in your project");
Hi,
I just noticed that the hardware model for iPhone 6, 6 plus CDMA models are not specified. Please let me know if the assumption is incorrect.
Hello! Please add new iPod's touch (iPod7,1 and iPod9,1)
Thx!
I've been happily using DeviceUtil, which is being replaced by DeviceGuru.
Sadly, I'm not a Swift guru and am hoping someone can post instructions for using DeviceGuru in my Objective-C project. Thanks.
Need to make a release. In current version 6.1.7 of library missing code for iPad Air 4
Hi,
I'm getting this assertion because [deviceUtilBundle pathForResource:@"DeviceList" ofType:@"plist"] reurns nil. Another note to take account is that everything is ok on simulator, it just occures when i run the project on the device, iphone 5. What could cause this?
iPad6,3 = iPad Pro 9.7" WiFi Only (128 GB)
[DeviceUtil logMessage:] [Line 233] This is a device which is not listed in this category. Please visit https://github.com/InderKumarRathore/DeviceUtil and add a comment there.
[DeviceUtil logMessage:] [Line 234] Your device hardware string is: iPad6,3
Just thought I would bring up the issue of being able to determine the simulator hardware as a specific device rather than just "Simulator". One reason I bring this up is because in my application I need to present information to the user and change it depending on their device/screen size. I don't have an iPhone 6 plus to test the layout of the information on, and I need to use the simulator.
By the way, thanks for developing this utility.
6+ = iPhone7,1 (confirmed on device)
6 = iPhone7,2 (apparently)
Hello, can you add new released devices to DeviceUtil.plist, enumeration and constants, please?
iPad Pro 12.9"
iPad Pro 10.5"
Thank you!
Could you add support for iPod 6th gen?
http://www.everymac.com/ultimate-mac-lookup/?search_keywords=iPod7,1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.