Questions tagged [uidevice]

The UIDevice class provides a singleton instance representing the current device. From this instance you can obtain information about the device such as assigned name, device model, and operating-system name and version. Available in iOS 2.0 and later

UIDevice instance is used to detect changes in the device’s characteristics, such as physical orientation. You get the current orientation using the orientation property or receive change notifications by registering for the UIDeviceOrientationDidChangeNotification notification. Before using either of these techniques to get orientation data, you must enable data delivery using the beginGeneratingDeviceOrientationNotifications method.

When you no longer need to track the device orientation, call the endGeneratingDeviceOrientationNotifications method to disable the delivery of notifications.

Source: UIDevice Class reference

Related tag:

Related SO Questions:

174 questions
2
votes
2 answers

How to know if current device can have background mode

I am doing some tasks after having entered in background mode. I want to do these tasks only if I am in background mode so I did : if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground) But applicationState is…
kheraud
  • 5,048
  • 7
  • 46
  • 75
2
votes
3 answers

Why isn't a registered UIDeviceOrientationDidChangeNotification always called?

I wrote a simple view controller that shows a modal popup dialog. Because it creates a new window to lay over the entire screen, I've added a UIDeviceOrientationDidChangeNotification observer that figures out how to rotate the view using…
theory
  • 9,178
  • 10
  • 59
  • 129
2
votes
1 answer

UIDevice.current.orientation report wrong value

I locked my view in portrait, but for some reason I need to know the actual device orientation, The UIDevice.current.orientation as documentation is saying in description Returns the physical orientation of the device. this var sometimes works well…
mehdok
  • 1,499
  • 4
  • 29
  • 54
2
votes
0 answers

iOS UIDeviceBatteryStateDidChangeNotification Not Working in Appstore version

I am really confuse the problem that I have. Here is my code to detect when USB cable Plugged In with device. -(void)setUpNotification { [[UIDevice currentDevice] setBatteryMonitoringEnabled:YES]; if ([UIDevice currentDevice].batteryState ==…
Shohrab
  • 546
  • 6
  • 21
2
votes
2 answers

Is there an API in Swift to determine processor register size of iOS device?

I am displaying to the user whether their device is 32-bit or 64-bit. Currently, I am determining that based on the value of UInt.max: let cpuRegisterSize = count(String(UInt.max, radix: 2)) It feels a little hacky, so I was wondering if there was…
mdaigle
  • 303
  • 3
  • 8
2
votes
5 answers

UIDevice currentDevice identifierForVendor - can this change on an iPad

My app uses UIDevice currentDevice identifierForVendor to help me identify the device. Recently I have encountered a situation that I can't understand. A UIDevice currentDevice identifierForVendor of an iPad of one of my clients seems to have…
RGriffiths
  • 5,722
  • 18
  • 72
  • 120
2
votes
1 answer

How to findObject in UiAutomator using position on screen (bounds)

I want to use device.findObject() to find an object in my screen, which requires a UiSelector. So far so good. The problem is that I have several items only distinguishable by their position on the screen, e.g., in the messaging application all the…
Inês
  • 882
  • 3
  • 13
  • 28
2
votes
2 answers

Make iPad app a Universal app

I have an iPad app that I would like to make Universal, however this seems alarmingly difficult. I've changed things around so that I support both builds, but when building, I get lots of errors about using UIPopOvers. Here're my questions: Why…
Peter Hajas
  • 4,011
  • 4
  • 25
  • 28
2
votes
1 answer

UIDeviceBatteryLevelDidChangeNotification background notifications?

We are looking to develop an app which will alert users if their battery level drops below a certain percentage however we are finding that our application does not seen to get this NSNotifications when it is not active. Does any one have any…
MonkeyBlue
  • 2,234
  • 6
  • 31
  • 41
2
votes
0 answers

identifierForVendor for iOS6 or later. What about identifying iOS5 or earlier devices from the same app?

I needed a unique ID for each device which uses an app built in Xcode 6.1 (iOS 8.1). I have used identifierForVendor for devices with iOS 6 or later. However the app is also meant to support iOS 5 or earlier devices. So what I did is if ([[UIDevice…
Sibir
  • 313
  • 2
  • 6
  • 20
2
votes
1 answer

UIDevice has phone capability? iOS8 (can make phone call)

I currently use this method in a UIDevice category to easily detect device with phone capability. On iOS8 however this does not work any more =( +(BOOL)hasPhoneCapability; { return [[UIApplication sharedApplication] canOpenURL:[NSURL…
Gustaf
  • 21
  • 2
2
votes
2 answers

Will Apple reject my app if I use the UUID of device?

I am using UUID of current device. I have to send that ID to a server for registering my device. So I used a bit of code like: NSString *uuidString = nil; CFUUIDRef uuid = CFUUIDCreate(NULL); if (uuid) { uuidString = (NSString…
sudheer
  • 418
  • 6
  • 20
2
votes
2 answers

Retrieving device WiFi MAC address with iOS 7

Our app is using device WiFiMAC address to uniquely identify a device. As per the Apple doumentation we shall start using identifierForVendor property of UIDevice but my app is strongly dependent on WiFi MAC address. At run time, app users look into…
Abhinav
  • 37,684
  • 43
  • 191
  • 309
2
votes
2 answers

Detecting The iPhone Device Type

I'm having an issue when I deploy my app my phone. I am currently building the app on a 3gs, when the view is displayed, it is the iPhone 5 layout that shows, which makes some objects display partially off of the screen. Is there a way I can detect…
2
votes
1 answer

Battery State Always Returning Null

I have the method below that returns the battery charge level correctly but does not get the battery state. It always returns UNKNOWN. -(NSString *)batteryStatus { UIDevice *device = [UIDevice currentDevice]; NSString *batteryStateString =…
motionpotion
  • 2,656
  • 6
  • 42
  • 60