Can we find the iDevice model? - ios

Can we retrieve the iDevice Model like it is shown in
Settings->General->About->Model = MD662F ?

Unfortunately, no. UIDevice has a "model" property, but will only return #”iPhone” and #”iPod touch”, etc.
UIDevice *currentDevice = [UIDevice currentDevice];
NSString *model = [currentDevice model];
NSLog(#"Device Model: %#", model);

Related

Getting iPhone Data

I own a wholesale distribution business focusing on iPhones. I am also an apple developer. I want to create a database that stores all device information by simply installing the app. I understand that this would completely be rejected if I were to send it off to the App Store but this is just in house and I will install simply with Apple Configurator.
I have found online that you no longer can get access to UDID and IMEI numbers. Is there a way for me to do this, not worrying about getting into the app store review policies. I just need an NSString for basic information about the device.
UDID
IMEI
Carrier
iOS Version
Storage Capacity
Model
I know how to find iOS Version and Model but cannot find any others.
You can no longer get UDID or IMEI.
To get the other data:
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
// carrier info
CTTelephonyNetworkInfo *netinfo = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier *carrier = [netinfo subscriberCellularProvider];
NSLog(#"Carrier Name: %#", [carrier carrierName]);
// Misc device info
UIDevice *myDevice = [UIDevice currentDevice];
NSString *deviceName = myDevice.Name;
NSString *deviceSystemName = myDevice.systemName;
NSString *deviceOSVersion = myDevice.systemVersion;
NSString *deviceModel = myDevice.model;
// Get the capacity of the device.
NSError *error = nil;
NSArray * const paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSDictionary * const pathAttributes = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths firstObject] error:&error];
NSAssert(pathAttributes, #"");
NSNumber * const fileSystemSizeInBytes = [pathAttributes objectForKey: NSFileSystemFreeSize];
const long long numberOfBytesRemaining = [fileSystemSizeInBytes longLongValue];
NSByteCountFormatter *byteCountFormatter = [[NSByteCountFormatter alloc] init];
NSString *formattedNmberOfBytesRemaining = [byteCountFormatter stringFromByteCount:numberOfBytesRemaining];
NSString *formattedNmberOfBytesTotal = [byteCountFormatter stringFromByteCount:fileSystemSizeInBytes ];

How can i get Default mail address and phone number from iOS Device?

As of i know we can get only these but i need to get Email and phone , is there any idea or anyone implemented befor?
#property(nonatomic,readonly,strong) NSString *name; // e.g. "My iPhone"
#property(nonatomic,readonly,strong) NSString *model; // e.g. #"iPhone", #"iPod touch"
#property(nonatomic,readonly,strong) NSString *localizedModel; // localized version of model
#property(nonatomic,readonly,strong) NSString *systemName; // e.g. #"iOS"
#property(nonatomic,readonly,strong) NSString *systemVersion; // e.g. #"4.0"
NSString *dnamee= [UIDevice currentDevice].identifierForVendor.UUIDString;

How to get UDID of iOS Device Programmatically in iOS 7

i am using the below code to display the UDID of the device.
But its displaying the null value
i.e. 2014-05-12 11:56:06.896 LoginScreen[195:60b] deviceUDID: (null)
NSUUID *deviceId;
deviceId = [UIDevice currentDevice].identifierForVendor;
NSLog(#"deviceUDID: %#",deviceID);
Sorry to all of you. I made a silly mistake
Here NSUUID instance is deviceId and i am printing deviceID in NSLog :)
Now it is working for me. Thanks to everyone
In order to get UUID of the device you can use the following line of code
[[[UIDevice currentDevice] identifierForVendor] UUIDString];
But you have to check whether the app is running on simulator or on device.
hope this helps you.
Apple has hidden the UDID from all public APIs, starting with iOS 7. Any UDID that begins with FFFF is a fake ID.
Objective-C :
NSString *strUUIDValue = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
NSLog(#"strUUIDValue : %#", strUUIDValue);
Swift 2 :
let UUIDValue = UIDevice.currentDevice().identifierForVendor!.UUIDString
print("UUID: \(UUIDValue)")
NSString *string = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
string = [string stringByReplacingOccurrencesOfString:#"-" withString:#""];
string = [NSString stringWithFormat:#"%#%#",#"FFFFFFFF",string];
Try this
NSUUID *deviceId;
#if TARGET_IPHONE_SIMULATOR
deviceId = [NSUUID initWithUUIDString:#"UUID-STRING-VALUE"];
#else
deviceId = [UIDevice currentDevice].identifierForVendor;
#endif
OR
NSString *uuid = nil;
CFUUIDRef theUUID = CFUUIDCreate(kCFAllocatorDefault);
if (theUUID) {
uuid = NSMakeCollectable(CFUUIDCreateString(kCFAllocatorDefault, theUUID));
[uuid autorelease];
CFRelease(theUUID);
}

UUID v1 Objective-C implementation

I want to implement UUID v1 in my iOS App.
I know that it is composed of Mac Address and timestamp as described in
http://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_.28MAC_address.29
Is there any objective-c implementation for this V1, based on CFUUID functions ?
I already have the mac address and the timestamp.
The UUID v1 description at Wikipedia : "The original (version 1) generation scheme for UUIDs was to concatenate the UUID version with the MAC address of the computer that is generating the UUID, and with the number of 100-nanosecond intervals since the adoption of the Gregorian calendar in the West"
It is also specified at http://www.ietf.org/rfc/rfc4122.txt , but it seems that it will need time to implement it.
I have found this link : http://www.famkruithof.net/guid-uuid-timebased.html who have a simple explanation for the steps to create a v1 UUID. Is there any existing implementation, before I implement it by my self?
I thinks it is common behavior to use framework functions. And that is use CFUUID. For example:
+(NSString*)get {
NSString *deviceID = [[NSUserDefaults standardUserDefaults] objectForKey:#"DeviceID"];
if (!deviceID) {
CFUUIDRef theUUID = CFUUIDCreate(NULL);
CFStringRef string = CFUUIDCreateString(NULL, theUUID);
CFRelease(theUUID);
deviceID = (NSString*)string;
[[NSUserDefaults standardUserDefaults] setValue:deviceID forKey:#"DeviceID"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
return deviceID;
}
Please try this one. It may be helpful to you
+(NSString*) Create_UDID
{
CFUUIDRef theUUID = CFUUIDCreate(NULL);
CFStringRef string = CFUUIDCreateString(NULL, theUUID);
CFRelease(theUUID);
NSString* strString = [NSString stringWithFormat:#"%#", string];
NSString *strValue = [strString stringByReplacingOccurrencesOfString:#"-"withString:#""];
if (strValue == nil) {
strValue = #"";
}
return strValue;
}

Localization with %#

I am trying to localize the text "System Name:" in the code below:
NSString *systemName = [NSString stringWithFormat:#"System Name: %#", [[UIDevice
currentDevice] systemName];
I do this by changing the code to this:
NSString *systemName = NSLocalizedString(#"SystemNameKey", #"System Name Info");
In my Localizable.strings file, I add the following code:
"SystemNameKey" = "System Name: %#", [[UIDevice currentDevice] systemName];
Of course, this will not work because UIKit is not imported into the Localizable.stings, and not surprisingly, when I add the import code, it does not work. I am sure there is an alternate way of doing this that I'm just not thinking of at the moment. Any ideas? I feel like I'm missing something really obvious.
You should try doing it this way:
NSString *systemNameLocalized = NSLocalizedString(#"SystemNameKey", #"System Name Info");
NSString *systemName = [NSString stringWithFormat:systemNameLocalized, [[UIDevice currentDevice] systemName]];
and in your Localizable.string file:
"SystemNameKey" = "System Name: %#";

Resources