Giter Site home page Giter Site logo

deviceutil's Introduction

Hi 👋, I'm Inder

Stack Overflow Stats

Inder's SO profile


GitHub Stats

inderkumarrathore

 inderkumarrathore

inderkumarrathore


inderkumarrathore



Connect with me

inderkumarrathore

deviceutil's People

Contributors

ben-j69 avatar coeur avatar filograno avatar gooichi avatar inderkumarrathore avatar ivanrublev avatar jk avatar kaspik avatar koenpunt avatar liamdon avatar marchbold avatar mattlewin avatar mazyod avatar metasmile avatar mickorand avatar mtak- avatar nicoyuste avatar notoroid avatar ohkanghoon avatar peterschuebel avatar phedlund avatar rokgregoric avatar rs0616 avatar skumancer avatar stevemoser avatar wbcyclist avatar witekbobrowski avatar wj2061 avatar yarry avatar zhaozzq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deviceutil's Issues

Crash bug

Hey, I am experiencing a bug, ARC environment, how can I encounter such a problem? what should I do?

--

hardwareDescription needs update for iPad Air and iPad mini retina

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";

Version in DeviceList.plist

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>

Support Apple Silicon Mac device identifiers?

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).

README.md

The iPhone 6s is listed in the README.md document as "iPhone8,2". I think that should be "iPhone8,1".

hardware method disappeared

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?

DevicePlist not found in the bundle assertion.

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?

Add Objective-C examples to DeviceGuru?

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.

Extend with GPS capability - Should we add this? plz comment

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;

iPhone 6 / 6 Plus has errors

hi there!

Your iphone 6 / 6 plus strings are matched incorrectly in

  • (Hardware)hardware;
  • (NSString*)hardwareDescription;

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

Determine different simulators i.e. iPhone 6 and iPhone 6 plus

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.

NSInvalidArgumentException on accessing hardwareDescription

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

support arc

I will be appreciate that if you can support arc.

Plist not included with use_frameworks

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");

Simulator with device ?

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.

Harware will never resolve to simulator

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?

New iPads 2017

Hello, can you add new released devices to DeviceUtil.plist, enumeration and constants, please?
iPad Pro 12.9"
iPad Pro 10.5"

Thank you!

Compile error in some macros.

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

Naming convention may conflict with UIKit

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.)

Reintroduce hardwareSimpleDescription method

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.