Reputation: 4167
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.
Upvotes: 0
Views: 1552
Reputation: 7417
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?.
Upvotes: 4