Can I tell if the iPhone has a passcode? - iphone

I'm developing an application that asks for a PIN when you start it. That's not great, but I can live with it. The problem is I'm being asked to ask for the PIN each time the phone wakes from sleep, too. Combined with the OS asking for its passcode, it's too much.
Is there any legitimate way to detect if the phone has a passcode required for waking, so I can skip requiring a PIN in this case? I don't want to know the PIN and I don't actually care if it was locked (for instance, if the phone was asleep very briefly), I just want to know that the data is in some way "protected."

For AppStore or not? If the former, no way.
In 3.x, the passcode is stored on the keychain, that means you have to get into the SpringBoard process to determine whether a passcode exists and nonempty. If you are in SpringBoard, calling -[SBAwayController isPasswordProtected] will determine if the device has passcode.

I created a very ugly workaround for this same issue.

Related

lock the iphone for limited amount of time

I am working on an application in which I want to set the password that locks the phone for a limited amount of time. While the password is set, the phone is locked except for sending or receiving phone calls to emergency numbers or user selected numbers in the application.
The phone is unlocked either when the time expires or when we enters the password.
My question is that is it possible ?
No. It's not possible on a vanilla iOS device. Maybe with a jailbreak.
May I ask why you want to create an app like that? The phone's lock works almost like that already?

Turn on/off GPS programmatically without prompting the user in iphone

I'm planning to code an application for the times when someone's iphone is lost or stolen. So it needs to tell the location of the phone via GPS, but in case it's stolen, it wouldn't be a good idea to ask the thief to turn on the GPS. So I'd like to know if there is a possibility of turning on/off the GPS without prompting the user. Thanks.
I'm not sure if you have seen this or not: Apple's 'find my iPhone'
Either way, The app would have to be running, with GPS enabled, for the service to work correctly. Any half-wit thief would know to quit such an application
You can't bypass the prompt completely. But it won't show up forever, if the user allows the app to use location data. Once the user allows this access twice, the app won't prompt any more. For an app like the one you describe, the user would have to do this first, and only then could future access proceed without a prompt.
There's still the pointer icon at the top of the screen when location services is active. There's no way around that, though.

Ask iPhone 4 to send back geotag information to server on the background

I wonder if it is possible for iPhone 4:
I have a server which sends queries about the location of the phone (irregularly) via an iPhone app. Customer can choose a setting that allow the phone to send back geotag information (longitude and lattitude) in the background (without customers doing anything).
If it is possible, how should I do it? If not, what is the closest alternative available?
Thank you.
Yes, you can do this. You have to set the UIBackgroundModes flag in your Info.plist to indicate that you execute in the background.
See: Information Property List Keys
Note that running the GPS from the background will severely impact battery life. In addition your application may be terminated at any time if the system needs the memory.

getting into SpringBoard process in IOS

I was having a requirement in my app where I need to check whether the iphone/ipad has a passcode protect set and If not, my app needs to notify the user to set a passcode protect for the device... I came across a post where a user says that if I can get to the springboard process and use the [SBAwayController isPasswordProtected] functionality, I can know if the passcode is set or not..
My problem is I do not know how to get to the springboard process and I dont know how to use the above code to work.
It would be great if someone could help me out in this.
On a non-jailbroken iPhone, there's no way to access the Springboard process and no direct way to determine whether the user has set a passcode. You can sort-of detect passcode locking by creating a protected file and then waiting to see whether you get locked out of it, but I don't think you can ever definitively say that the user has not set a passcode using this approach.
In an enterprise environment, you can require passcodes by setting policies at the device level, using the instructions in Apple's Enterprise Deployment Guide, which may be a better solution.
See also How can I find out if the iPhone user currently has a passcode set and encryption enabled?.

Recognising nearby iPhones running my app

I have a requirement in my iPhone app that I know when somebody running the same app is close by.
I'm thinking that GameKit using Bluetooth would let me do that. GPS location is not precise enough in this particular case.
However, if the user closes the app then the function won't work anymore. Even under iOS4, the task switching will close down the BonJour services so I can't have the app run in the background.
Seems to me I can only have this function if the user leaves the app up and running. Would you agree? Or is there a different approach I can take?
People are very concerned with privacy, so they would naturally expect such privacy invading functionality to be switched off when they close down the application.
If they choose to have this feature enabled, then it's a different matter. Then they expect that somebody else may locate them.
You might however consider implementing some sort of opt-in offline service, where the latest gps position is stored on a server including a timestamp. When somebody else (with the app running) moves within a certain distance of this location while it's still "fresh", then you send off a notification to the first device. That way the user would be notified that somebody may be close, and can then switch on their own device.