I have a toggle in my app that's "download on WiFi only". However, that toggle is useless for iPod touch or WiFi-iPads.
Is there a way to know if the device has cellular data capabilities in code? Something that would work in the future would be great too (like if an iPod touch 5th gen with 3G comes out).
Hi you should be able to check if it has the pdp_ip0 interface
#import <ifaddrs.h>
- (bool) hasCellular {
struct ifaddrs * addrs;
const struct ifaddrs * cursor;
bool found = false;
if (getifaddrs(&addrs) == 0) {
cursor = addrs;
while (cursor != NULL) {
NSString *name = [NSString stringWithUTF8String:cursor->ifa_name];
if ([name isEqualToString:#"pdp_ip0"]) {
found = true;
break;
}
cursor = cursor->ifa_next;
}
freeifaddrs(addrs);
}
return found;
}
This doesn't use any private APIs.
3G by itself seems tough to find. You can find out whether a device can make calls using [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"tel://"]]. You can check whether a device can get to the internet, period (and by which method that can currently happen) using Reachability code:
NetworkStatus currentStatus = [[Reachability reachabilityForInternetConnection]
currentReachabilityStatus];
if(currentStatus == kReachableViaWWAN) // 3G
else if(currentStatus == kReachableViaWifi) // ...wifi
else if(currentStatus == kNotReachable) // no connection currently possible
..but aside from that, I don't think you can check for the existence of a 3G modem in the device.***** If it can't make a call, and doesn't currently have cell data turned on and wifi turned off, you won't be able to find out if it's 3G-capable.
An alternative way (not forward-compatible though, so you probably don't want to do this) is to compare the device's model with an exhaustive list, knowing which ones have 3G modems in them, as shown here.
***** As per bentech's answer, if you want to go digging around with device names (this may stop working with no advance warning if Apple decide to change the 3g interface name), call getifaddrs and check for the pdp_ip0 interface.
Swift 3.0 (UIDevice+Extension) of #bentech's answer
Add this line to your BridgingHeader.h:
#import <ifaddrs.h>
Somewhere else:
extension UIDevice {
/// A Boolean value indicating whether the device has cellular data capabilities (true) or not (false).
var hasCellularCapabilites: Bool {
var addrs: UnsafeMutablePointer<ifaddrs>?
var cursor: UnsafeMutablePointer<ifaddrs>?
defer { freeifaddrs(addrs) }
guard getifaddrs(&addrs) == 0 else { return false }
cursor = addrs
while cursor != nil {
guard
let utf8String = cursor?.pointee.ifa_name,
let name = NSString(utf8String: utf8String),
name == "pdp_ip0"
else {
cursor = cursor?.pointee.ifa_next
continue
}
return true
}
return false
}
}
In iOS 6.1, I've been able to use Core Telephony to successfully check for the presence of cellular baseband capabilities. This works on all iPads I tested: Verizon with service activated and without, AT&T with service currently deactivated, SIM card in and out, and a Wi-Fi-only iPad.
The code I used looks like this:
CTTelephonyNetworkInfo* ctInfo = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier* carrier = ctInfo.subscriberCellularProvider;
self.hasWWANCapability = carrier != nil;
For all the iPads with cellular baseband hardware, carrier is not nil. For the Wi-Fi-only iPad, carrier is nil.
I'd think you should be able to use the CoreTelephony Framework.
It does call out that it is for carriers to use, so I am not sure if it is against TOS to access it.
Carriers can use this information to write applications that provide services only for their own subscribers
One way of doing it is to ask for the users location. When it is as accurate as possibLe, you will know if the device have GPS. All devices that have GPS will have 3G. And those that don't GPS won't have 3G.
Apple provided code here.
https://developer.apple.com/library/ios/samplecode/Reachability/Introduction/Intro.html
You should copy Reachability.h and Reachability.m to your project and import
Reachability.h to your class,then
Reachability *networkReachability = [Reachability reachabilityForInternetConnection];
NetworkStatus networkStatus = [networkReachability currentReachabilityStatus];
while (networkStatus==NotReachable) {
NSLog(#"not reachable");
//no internet connection
return;
}
while (networkStatus==ReachableViaWWAN) {
NSLog(#" ReachableViaWWAN ");
}
while (networkStatus==ReachableViaWiFi) {
NSLog(#"ReachableViaWiFi");
}
Another way is to extend this: https://github.com/monospacecollective/UIDevice-Hardware/blob/master/UIDevice-Hardware.m with this:
-(bool) hasCellular:(NSString*)modelIdentifier {
if ([modelIdentifier hasPrefix:#"iPhone"]) return YES;
if ([modelIdentifier hasPrefix:#"iPod"]) return NO;
if ([modelIdentifier isEqualToString:#"iPad1,1"]) return NO;
if ([modelIdentifier isEqualToString:#"iPad2,1"]) return NO;
if ([modelIdentifier isEqualToString:#"iPad2,2"]) return YES;
if ([modelIdentifier isEqualToString:#"iPad2,3"]) return YES;
if ([modelIdentifier isEqualToString:#"iPad2,4"]) return NO;
if ([modelIdentifier isEqualToString:#"iPad2,5"]) return NO;
if ([modelIdentifier isEqualToString:#"iPad2,6"]) return YES;
if ([modelIdentifier isEqualToString:#"iPad2,7"]) return YES;
if ([modelIdentifier isEqualToString:#"iPad3,1"]) return NO;
if ([modelIdentifier isEqualToString:#"iPad3,2"]) return YES;
if ([modelIdentifier isEqualToString:#"iPad3,3"]) return YES;
if ([modelIdentifier isEqualToString:#"iPad3,4"]) return NO;
if ([modelIdentifier isEqualToString:#"iPad3,5"]) return YES;
if ([modelIdentifier isEqualToString:#"iPad3,6"]) return YES;
if ([modelIdentifier isEqualToString:#"iPad4,1"]) return NO;
if ([modelIdentifier isEqualToString:#"iPad4,2"]) return YES;
if ([modelIdentifier isEqualToString:#"iPad2,5"]) return NO;
if ([modelIdentifier isEqualToString:#"iPad2,6"]) return YES;
if ([modelIdentifier isEqualToString:#"iPad2,7"]) return YES;
if ([modelIdentifier isEqualToString:#"iPad4,4"]) return NO;
if ([modelIdentifier isEqualToString:#"iPad4,5"]) return YES;
if ([modelIdentifier isEqualToString:#"i386"]) return NO;
if ([modelIdentifier isEqualToString:#"x86_64"]) return NO;
return YES;
}
(Clearly it could be edited down to remove either the NO or YES only depending on which way you want to err in case there is a new model...)
Related
I have a classic Apple reachability class which is not adapted to ARC. It defines the network pretty well but it has some mistake that I can't figure out. I've left the whole class unchanged and in the method of another class, I have implemented the following methods to define the connectivity. Here's my BOOL value that changes whenever the internet is available:
- (BOOL) checkForInternetConnection {
[self checkNetworkStatus:nil];
if (isConnection || is3G) {
return YES;
} else {
return NO;
}
}
And here's the standard Reachability method:
-(void) checkNetworkStatus:(NSNotification *)notice
{
NetworkStatus internetStatus = [internetReachable currentReachabilityStatus];
switch (internetStatus)
{
case NotReachable:
{
isConnection = NO;
is3G = NO;
}
case ReachableViaWiFi:
{
isConnection = YES;
is3G = NO;
break;
}
case ReachableViaWWAN:
{
NSLog(#"Connected via 3G");
is3G = YES;
break;
}
}
NetworkStatus hostStatus = [hostReachable currentReachabilityStatus];
switch (hostStatus)
{
case NotReachable:
{
isConnection = NO;
is3G = NO;
NSLog(#"No Network");
break;
}
case ReachableViaWiFi:
{
NSLog(#"Connected via WiFi");
isConnection = YES;
is3G = NO;
break;
}
case ReachableViaWWAN:
{
NSLog(#"Connected via 3G");
is3G = YES;
break;
}
}
}
The problem I'm getting is well seen in the NSLog output I get:
2012-12-24 11:19:41.045 Custom Queue[1723:907] Connected via 3G
2012-12-24 11:19:41.046 Custom Queue[1723:907] No Network
2012-12-24 11:19:41.047 Custom Queue[1723:907] Connected via 3G
2012-12-24 11:19:41.048 Custom Queue[1723:907] No Network
After a few seconds it informs me that all is well:
2012-12-24 11:20:11.101 Custom Queue[1723:907] Connected via 3G
2012-12-24 11:20:11.112 Custom Queue[1723:907] Connected via 3G
2012-12-24 11:20:11.113 Custom Queue[1723:907] Connected via 3G
But due to the fact that it thinks that the host is unreachable and gives me the message that there's no connection, I have another function that fires when the Internet is unavailable.
How do I change it so it sees the Internet connection faster, without that occasional "no network" message?
I ended up using Reachability version from Tony Million.
It's great and easy to use. Moreover, it's ARC and iOS 5 (and up) ready.
You can get it here:
https://github.com/tonymillion/Reachability
Thanks, Tony!
I have found the solutions from here:
Determine device (iPhone, iPod Touch) with iPhone SDK
From the link, it suggests to use the library https://gist.github.com/1323251
But obviously the library is quite outdated. I couldn't find the iPhone 5 and new iPad and etc in the list.
Does anyone know how can I find the completed and updated list?
Thank you so much.
you can easily detect iphone, iphone5 and iPad with below condition:-
if([[UIDevice currentDevice]userInterfaceIdiom]==UIUserInterfaceIdiomPhone)
{
if ([[UIScreen mainScreen] bounds].size.height == 568.0f)
{
}
else
{
//iphone 3.5 inch screen
}
}
else
{
//[ipad]
}
my answer:-
Detect device type
Here's the updated version of https://gist.github.com/1323251 .
I'll keep it updated when new devices are released.
https://github.com/froztbytes/UIDeviceHardware
This works just fine:
if([UIDevice currentDevice].userInterfaceIdiom==UIUserInterfaceIdiomPad) {
NSLog(#"IPAD");
}else{
NSLog(#"IPHONE");
}
Just adding to #Mohammad Kamran Usmani answer. More specific iPhone types:
#import UIKit;
//Check which iPhone it is
double screenHeight = [[UIScreen mainScreen] bounds].size.height;
if(UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad)
{
NSLog(#"All iPads");
} else if (UI_USER_INTERFACE_IDIOM()== UIUserInterfaceIdiomPhone)
{
if(screenHeight == 480) {
NSLog(#"iPhone 4/4S");
smallFonts = true;
} else if (screenHeight == 568) {
NSLog(#"iPhone 5/5S/SE");
smallFonts = true;
} else if (screenHeight == 667) {
NSLog(#"iPhone 6/6S");
} else if (screenHeight == 736) {
NSLog(#"iPhone 6+, 6S+");
} else {
NSLog(#"Others");
}
}
Use the following code:
#import <sys/utsname.h>
- (NSString *)machineName
{
struct utsname systemInfo;
uname(&systemInfo);
NSString *temp = [NSString stringWithCString:systemInfo.machine
encoding:NSUTF8StringEncoding];
if ([temp rangeOfString:#"iPod"].location != NSNotFound)
{
return #"iPod";
}
if ([temp rangeOfString:#"iPad"].location != NSNotFound)
{
return #"iPad";
}
if ([temp rangeOfString:#"iPhone"].location != NSNotFound)
{
return #"iPhone";
}
return #"Unknown device";
}
I'm with other guys are maintaining the code on GitHub so please take the latest code from there. We're continuously adding new devices in the list.
Objective-C : GitHub/DeviceUtil
Swift : GitHub/DeviceGuru
#include <sys/types.h>
#include <sys/sysctl.h>
- (NSString*)hardwareDescription {
NSString *hardware = [self hardwareString];
if ([hardware isEqualToString:#"iPhone1,1"]) return #"iPhone 2G";
if ([hardware isEqualToString:#"iPhone1,2"]) return #"iPhone 3G";
if ([hardware isEqualToString:#"iPhone3,1"]) return #"iPhone 4";
if ([hardware isEqualToString:#"iPhone4,1"]) return #"iPhone 4S";
if ([hardware isEqualToString:#"iPhone5,1"]) return #"iPhone 5";
if ([hardware isEqualToString:#"iPod1,1"]) return #"iPodTouch 1G";
if ([hardware isEqualToString:#"iPod2,1"]) return #"iPodTouch 2G";
if ([hardware isEqualToString:#"iPad1,1"]) return #"iPad";
if ([hardware isEqualToString:#"iPad2,6"]) return #"iPad Mini";
if ([hardware isEqualToString:#"iPad4,1"]) return #"iPad Air WIFI";
//there are lots of other strings too, checkout the github repo
//link is given at the top of this answer
if ([hardware isEqualToString:#"i386"]) return #"Simulator";
if ([hardware isEqualToString:#"x86_64"]) return #"Simulator";
return nil;
}
- (NSString*)hardwareString {
size_t size = 100;
char *hw_machine = malloc(size);
int name[] = {CTL_HW,HW_MACHINE};
sysctl(name, 2, hw_machine, &size, NULL, 0);
NSString *hardware = [NSString stringWithUTF8String:hw_machine];
free(hw_machine);
return hardware;
}
You can use the following code
if(screenSize.width==2048 && screenSize.height==1536)
{
LetterParams.DeviceType=1;//IPadRetina
}
else if(screenSize.width==2048/2 && screenSize.height==1536/2)
{
LetterParams.DeviceType=2;//IPad Non-Retina
}
else if(screenSize.width==1136 && screenSize.height==640)
{
LetterParams.DeviceType=3;//IPhoneRetina
}
else
{
LetterParams.DeviceType=4;//IPhone & Ipod
}
Here is a method that I came up with that focuses on key devices for screen measurement functions. It is a quick way to determine what you need. This will detect up to iPhone 5 and 5th Gen. iPod touches.
typedef enum{
iPadRetina,iPadNoRetina,iPhoneiPod35InchRetina,iPhoneiPod35InchNoRetina,iPhoneiPod4InchRetina}DeviceType;
-(void)yourCustomFunctionThatNeedsToKnowDeviceType
{
NSLog(#"device type = %i",[self getDeviceType]);
switch ([self getDeviceType])
{
case iPadRetina:
{
NSLog(#"This device is one of the following: iPad 3, iPad 4");
break;
}
case iPadNoRetina:
{
NSLog(#"This device is one of the following: iPad 1, iPad 2, iPad mini");
break;
}
case iPhoneiPod35InchRetina:
{
NSLog(#"This device is one of the following: iPhone 4/4S or iPod Touch 4th Generation");
break;
}
case iPhoneiPod35InchNoRetina:
{
NSLog(#"This device is one of the following: iPhone 3G/3GS or iPod Touch 3rd Generation");
break;
}
case iPhoneiPod4InchRetina:
{
NSLog(#"This device is one of the following: iPhone 5 or iPod Touch 5th Generation");
break;
}
}
}
-(int)getDeviceType
{
// Get the ratio of the device's screen (height/width)
CGFloat screenRatio = [UIScreen mainScreen].bounds.size.height/[UIScreen mainScreen].bounds.size.width;
// Initialize return value to negative value
DeviceType type = -1;
if(screenRatio > 1.5)
{
/*
4.0-Inch Screen
This implies that the device is either an iPhone 5 or a 5th generation iPod
Retina display is implicit
*/
type = iPhoneiPod4InchRetina;
}
else
{
/*
Device must be iPad 1/2/3/4/mini or iPhone 4/4S or iPhone 3G/3GS
*/
// Take a screenshot to determine if the device has retina display or not
UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, NO, 0.0);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *scaleCheckImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
{
/*
Device must be iPad 1/2/3/4/mini
*/
if(scaleCheckImage.scale == 1)
{
// iPad 1/2/mini (No Retina)
type = iPadNoRetina;
}
else if(scaleCheckImage.scale == 2)
{
// iPad 3/4 (Retina)
type = iPadRetina;
}
}
else
{
/*
Device must be iPhone 4/4S or iPhone 3G/3GS or iPod Touch 3rd Generation or iPod Touch 4th Generation
*/
if(scaleCheckImage.scale == 1)
{
// iPhone 3G/3GS or iPod Touch 3rd Generation (No Retina)
type = iPhoneiPod35InchNoRetina;
}
else if(scaleCheckImage.scale == 2)
{
// iPhone 4/4S or iPod Touch 4th Generation (Retina)
type = iPhoneiPod35InchRetina;
}
}
}
return type;
}
if(UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad)
{
NSLog(#"All iPads");
}
else
{
else if (UI_USER_INTERFACE_IDIOM()== UIUserInterfaceIdiomPhone)
{
if( screenHeight > 480 && screenHeight < 667 )
{
NSLog(#"iPhone 5/5s/6");
}
else if ( screenHeight > 480 && screenHeight < 736 )
{
NSLog(#"Other iPhones Resizable");
}
else if ( screenHeight > 480 )
{
NSLog(#"iPhone 6 +");
}
else
{
NSLog(#"iPhone 4s and others");
}
}
In my universal app I need to check if the current device is an iPad or iPhone. How can I do this programmatically? I plan to put the code in my viewDidLoad.
check if UISplitViewController class available on the platform, if so make sure it is iPad using Apple's macro (notice that UIUserInterfaceIdiomPad constant is available only on iOS 3.2 and up).
if (NSClassFromString(#"UISplitViewController") != nil && UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
//currentDeviceType = iPad;
}
else {
//currentDeviceType = iPhone;
}
Proper method to detect device model (iPhone/iPod Touch)?
I use this simple function in all my apps:
#import "isPad.h"
BOOL isPad () {
static BOOL isPad;
static BOOL used = NO;
if (used)
return isPad;
used = YES;
NSRange range = [[[UIDevice currentDevice] model] rangeOfString:#"iPad"];
isPad = range.location != NSNotFound;
return isPad;
}
try this.. this will help you.
NSString *deviceType = [UIDevice currentDevice].model;
if([deviceType isEqualToString:#"iPod touch"]||[deviceType isEqualToString:#"iPhone"]||[deviceType isEqualToString:#"iPad"]){
}
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
// Statements
}
else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
// Statements
}
So I've got a function that really helps when I'm crafting device specific URLS but I'd like to place it in a global header file so any class could use it easily
- (NSString *)deviceType
{
NSString *deviceName = #"iphone";
if([[UIScreen mainScreen] respondsToSelector:#selector(scale)])
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){
deviceName = #"ipad";
}
else {
deviceName = #"iphone4";
}
}
return deviceName;
}
That may or may not be the best way of doing it but I'd like to know how to get that into a global header so I can do something like this
NSString *deviceName = GETDEVICENAME;
#define GETDEVICENAME [whatever deviceType] maybe?
There is an issue with your function though, on 3.2 UIScreen doesn't respond to scale (at least no publicly. I wouldn't rely on that to check for iPad.
With in your project should be a file called %PROJECT%_Prefix.pch.
Any headers you include in that file will be accessible by all files in your project.
Got the answer that worked for me,
In a global header file Globals.h I placed
NSString* deviceType();
in Globals.m I placed a modified function
NSString* deviceType()
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){
return #"ipad";
}
else if([[UIScreen mainScreen] respondsToSelector:#selector(scale)])
{
return #"iphone4";
}
else{
return #"iphone";
}
}
This question already has answers here:
iOS detect if user is on an iPad
(17 answers)
Closed 8 years ago.
Is there an API for checking at runtime whether you are running on an iPhone or an iPad?
One way I can think of would be to use:
[[UIDevice currentDevice] model];
And detect the existence of the string #"iPad" - which seems a bit fragile.
In the 3.2 SDK, I see that UIDevice also has a property which is really what I'm looking for, but doesn't work for pre-3.2 (obviously):
[[UIDevice currentDevice] userInterfaceIdiom];
Are there other ways than checking for the existence of #"iPad" for a universal app?
Checkout UI_USER_INTERFACE_IDIOM.
Returns the interface idiom supported by the current device.
Return Value
UIUserInterfaceIdiomPhone if the device is an iPhone or iPod touch or UIUserInterfaceIdiomPad if the device is an iPad.
UIUserInterfaceIdiom
The type of interface that should be used on the current device
typedef enum {
UIUserInterfaceIdiomPhone,
UIUserInterfaceIdiomPad,
} UIUserInterfaceIdiom;
Just for my reference:
#property (nonatomic, readonly) BOOL isPhone;
-(BOOL)isPhone {
return (UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPhone);
}
or use a #define
#define IS_PHONE (UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPhone)
However, if you're using isPhone all over your code, that's generally bad practice. Use the factory pattern and polymorphism to keep your if statements contained, so you get objects created for phone or for iPad and then work with those.
Added
I'm using this solution all over my code now. It adds a standard factory pattern into the alloc.
#define ALLOC_PER_DEVICE() id retVal = nil; \
NSString *className = NSStringFromClass(self);\
if (IS_PHONE && ![className hasSuffix:#"Phone"]) {\
className = [NSString stringWithFormat:#"%#Phone", className];\
Class newClass = NSClassFromString(className);\
retVal = [newClass alloc];\
}\
if (!retVal)\
retVal = [super alloc];\
assert(retVal != nil);\
return retVal\
Then my allocs look like this:
+alloc { ALLOC_PER_DEVICE(); }
And I add a subclass called TheClassPhone for the phone version.
Note: Since there's no multiple inheritance in Objective-C, using inheritance to solve your problems is a bit overrated (i.e., it doesn't work if you have subclasses of subclasses). Nothing like a good if when you need it.
Use NSClassFromString and an iPad-specific class. Read more here:
http://developer.apple.com/iphone/library/documentation/General/Conceptual/iPadProgrammingGuide/StartingYourProject/StartingYourProject.html#//apple_ref/doc/uid/TP40009370-CH9-SW3
Check for the presence of the userInterfaceIdiom property, usings respondsToSelector:. If it doesn't exist, we are on a pre-3.2 device, thus not an iPad.
If userInterfaceIdiom exists, use it.
Edit: ... which is obviously exactly what the UI_USER_INTERFACE_IDIOM() macro does, so use that instead. :)
You can check if you run the app on iPhone or iPad by using the following code:
- (NSString *)deviceModel
{
struct utsname systemInfo;
uname(&systemInfo);
return [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
}
- (NSString *) platformString
{
NSString *platform = [self deviceModel];
if ([platform isEqualToString:#"iPhone1,1"]) return #"iPhone_2G";
else if ([platform isEqualToString:#"iPhone1,2"]) return #"iPhone_3G";
else if ([platform isEqualToString:#"iPhone2,1"]) return #"iPhone_3GS";
else if ([platform isEqualToString:#"iPhone3,1"]) return #"iPhone_4";
else if ([platform isEqualToString:#"iPhone3,3"]) return #"Verizon_iPhone_4";
else if ([platform isEqualToString:#"iPhone4,1"]) return #"iPhone_4S";
else if ([platform isEqualToString:#"iPhone5,1"]) return #"iPhone_5";
else if ([platform isEqualToString:#"iPhone5,2"]) return #"iPhone_5";
else if ([platform isEqualToString:#"iPod1,1"]) return #"iPod_Touch 1G";
else if ([platform isEqualToString:#"iPod2,1"]) return #"iPod_Touch 2G";
else if ([platform isEqualToString:#"iPod3,1"]) return #"iPod_Touch 3G";
else if ([platform isEqualToString:#"iPod4,1"]) return #"iPod_Touch 4G";
else if ([platform isEqualToString:#"iPad1,1"]) return #"iPad_1G";
else if ([platform isEqualToString:#"iPad2,1"]) return #"iPad_2(WiFi)";
else if ([platform isEqualToString:#"iPad2,2"]) return #"iPad_2(GSM)";
else if ([platform isEqualToString:#"iPad2,3"]) return #"iPad_2(CDMA)";
else if ([platform isEqualToString:#"iPad3,1"]) return #"iPad_3";
else if ([platform isEqualToString:#"iPad3,2"]) return #"iPad_3(GSM/CDMA)";
else if ([platform isEqualToString:#"iPad3,3"]) return #"iPad_3(GSM)";
else if ([platform isEqualToString:#"iPad3,4"]) return #"iPad_3(GSM)";
else if ([platform isEqualToString:#"iPad2,5"]) return #"iPad_mini_1G";
else if ([platform isEqualToString:#"i386"]) return #"Simulator";
else if ([platform isEqualToString:#"x86_64"]) return #"Simulator";
return platform;
}