Is UIApplicationExitsOnSuspend the same as exit(0)? - ios

I want to present a lock screen if TouchID/Pascode is set in my applications settings. I want it to work similar to Dropbox and 1Password where if you have this set, and then you press the Home button on the iPhone, if you reopen the app it automatically shows the lock screen and displays Touch ID alert.
For my app I want a similar behavior. In Ray Wenderlich's tutorial on security, they set UIApplicationExitsOnSuspend (also known as "Application does not run in background") to YES in the pList. The problem for me is that I don't want this set at all times - for my app it should only be set if Touch ID/Passcode is enabled by the user in my applications settings. So my concern is:
Can I set UIApplicationExitsOnSuspend programmatically in code?
If not, can I use exit(0) or exit(1)? I seen many stack overflow pages where they say not do this --- but I will only call this in applicationDidEnterBackground if Touch ID/Passcode is enabled by the user in my applications settings.
I want to launch this app to the app store as well. Thanks.

Related

iOS disable let user swipe the app in background list

In the iOS, when the user double home button , the app show in the list at background.
Have possible hidden my app show in the list, or force the user swiped the app, the app in the background can't close?
I just known applicationDidEnterBackground can do something in the background. But
I wish force the user can't swipe the app in the list or hidden the app in the list, or have some mobile device management method can do this effect(we can use private api)?
I search many time , but I was not found some answer...
thank you very much.
This is not possible in iOS, the user is in control and Apple does not allow your app to hide it self in this list.
If you want this you will need to target jailbroke devices and hook on the task switch. Then detect you app from being closed and restarted it.

Can you change the default Apple Watch watch?

I'm planning to make an watch app for the Apple Watch.
Is there any way of replacing the default home screen (or watch) of the device to be a custom watch?
Assuming there is none, the next best way would be to make a WatchKit App complete with with a Glance?
Does the apple watch come with a power saving mode by default where it will turn off the screen/running app reverting to it's home screen after a certain period of inactivity?
There is not at present any way to have a custom watch face. You could make an app with a glance view, but just to be clear a glance view cannot contain any buttons or interactive elements, it's just something to be looked at. If the user taps the glance it will open your watch app.

NSLocationWhenInUsageDescription prompt doesn't pop up

When I ran the app the NSLocationWhenInUsageDescription prompt came up once but never came up again after running it multiple times.
The app is still zooming into the current location and the Apple location.
The app works, but the question does not pop up.
Per the documentation: https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/index.html#//apple_ref/occ/instm/CLLocationManager/requestWhenInUseAuthorization, the question is asked only once, whether you tap "Allow" or "Deny". But you are still able to see the description in the Settings app, in Privacy settings, then Location services, and then your specific app. A description text should be displayed at the bottom of the view.

iOS app printing while running in the background

I have an iOS app that automatically prints a receipt to a thermal receipt printer when an order comes in and works great. However, if the app is in the background, it does not print. Is it possible to allow it to print while running in the background?
There are only a few occasions you are allowed to run certain tasks in the background. See the Apple documentation: https://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html#//apple_ref/doc/uid/TP40007072-CH4-SW20
For example: playing audio, fetching the user location, sending notification or certain data from network in the background is allowed. Running your own logic during a background service is, as far as I understood, not allowed (like running it one hour after your app is gone to sleep/background mode).
The only thing that is perhaps an option, is to utilize the time your app has to finish an task after the home button is pressed. There is a timelimit however of 10 or 15 minutes.
I don't know if this is suitable for your situation?
See this stackoverflow question: iOS application executing tasks in background
And this particular piece of code to run the task in the background: https://stackoverflow.com/a/11809211/2740112
Another option is to use Guided Access, which is introduced since iOS6.
With it, you can prevent exiting the app. It's only usefull when using only the app on the device that needs to be used.
Information below from http://www.assistiveware.com/support/faq/page/136:
To turn on Guided Access, do the following:
Go to the Settings app on your device's home screen.
Tap General.
Tap Accessibility.
Under the Learning section (scroll down if necessary), tap Guided Access.
Toggle Guided Access to ON.
Tap Set Passcode and enter a four digit passcode. You will be prompted to enter it again.
(Optional) Toggle Enable Screen Sleep to ON if you want to be able to put your device to sleep with the Power button, otherwise the Power button will be disabled.
To start Guided Access for an app and prevent it from being exited, do the following:
Open the app that you want to lock in.
Quickly press your device's Home button three times to bring up the Guided Access menu.
Tap the Start button in the top right corner of the screen to activate Guided Access. A message stating "Guided Access Started" will briefly appear.
To end Guided Access for an app so it can be exited, do the following:
Quickly press your device's Home button three times to bring up the Guided Access menu.
Enter your four digit passcode when prompted.
Tap the End button in the top left corner of the screen to end Guided Access. A message stating "Guided Access Ended" will briefly appear.
Here's the knowledgebase article of Apple: http://support.apple.com/kb/ht5509

iOS Always be on Startpage when App becomes active

I'm programming a quiz for the iPad and when the user presses the homebutton while in a quiz and relaunches the app I want the quiz to be already cancled and back on the Startpage of the app.
Now it simply gets back to the last view it was on.
Also I want it to show the splashscreen again when the app relaunches.
A complete reset of the app, when pressing the homebutton, would be great.
Thanks in advance
Choose the 'application does not run in background' option in your project's plist. If the option isn't there, press the '+' on the side to add the property.
This will ensure that the app starts afresh every time it's opened.
So, you want to disable multitasking?
Set UIApplicationExitsOnSuspend = YES in your info.plist.
Unless you just want them to resume through the screen, in which case you'll want to look into the lifecycle callbacks for your AppDelegate.

Resources