I am working in iPhone application, Using CLLocationManager to develop my application, when I run the application and its show one alert view like "Would like to use Your current location".
Then prees Ok to continue it.
But I don't want to show an alert view, is it possible to let the app track the user's location without a prompt?
Thanks in advance
This alert view is mandatory and there is no way to avoid it, unless you somehow create your own location tracking client, however any access of location without a prompt is prohibited by the guidelines and Apple will reject your app.
The reason is so users are aware that you are tracking your location -- security and preference.
Why would you want to avoid the alert view in the first place?
This dialog is promtped by the system for privacy and security reasons. If you somehow manage to avoid this and access location data, your app will be surely rejected during the App Store Approval Process. Why do you want to get rid of it?
No, I am 100% sure it's not possible to prevent this alert view
but I think when you click on Don't allow then your CLLocationManager is stop but you can again give it to allow from iphone setting
Related
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.
We don't want the user enter our app if the app is out-dated.
Is that is possible to quit a iOS app when we do some date check BEFORE the app launch?
Or it is possible to quit the application after the main view is loaded?
Before the app launches: no. The launch animation is already in progress when the OS calls main.
After some time (1-2 sec): yes. You can use one of
[[UIApplication sharedApplication] terminateWithSuccess];
exit(0);
abort();
assert(0);
pthread_kill(pthread_self());
so many ways, but neither will go through AppStpre - you're not supposed to close your app programmatically. You're supposed to notify the user via an UIAlertView about the outdated app and disable interaction with the app.
According to Apple you cannot exit(quit) your application through code. i.e if you use exit(0). Your application will be rejected for that. Although you can use exit(1) and delay the exit time of your application. Or you may like to use local notification which is quite handy.
Don’t Quit Programmatically
Never quit an iOS application programmatically because people tend to
interpret this as a crash. However, if external circumstances prevent
your application from functioning as intended, you need to tell your
users about the situation and explain what they can do about it.
Depending on how severe the application malfunction is, you have two
choices.
Display an attractive screen that describes the problem and suggests a
correction. A screen provides feedback that reassures users that
there’s nothing wrong with your application. It puts users in control,
letting them decide whether they want to take corrective action and
continue using your application or press the Home button and open a
different application
If only some of your application's features are not working, display
either a screen or an alert when people activate the feature. Display
the alert only when people try to access the feature that isn’t
functioning.
Source
I want to send my Application to background simply clicking on Button inside my Application.
Is there any way to call applicationdidenterbackground manually or any other way ?
iOS Human Interface Guidelines says "Don't Quit Programmatically", whereby quitting must be understood as including "suspending":
Never quit an iOS application programmatically because people tend to interpret this as a crash. However, if external circumstances prevent your application from functioning as intended, you need to tell your users about the situation and explain what they can do about it. Depending on how severe the application malfunction is, you have two choices.
Display an attractive screen that describes the problem and suggests a correction. A screen provides feedback that reassures users that there’s nothing wrong with your application. It puts users in control, letting them decide whether they want to take corrective action and continue using your application or press the Home button and open a different application
If only some of your application's features are not working, display either a screen or an alert when people activate the feature. Display the alert only when people try to access the feature that isn’t functioning.
If you really want to exit your app programmatically, then you can call exit(0);, but I doubt that you app will pass the Apple review.
Unfortunately There is no any officialy way to force app to background state(Pause state).
I am developing an iPhone app, that will not be distributed on AppStores. I have tried to search for private api but no luck. When the user tries to quit the app, I want to prompt the user to enter the correct password so as to enable him to exit the app. How can I achieve this? Thanks in advance.
Cheers!!
It sounds like you need something similar to iOS "Kiosk Mode" as described in this answer:
Put an iPhone or iPad into 'Store Demo' mode
Using that description in conjunction with the following steps might achieve precisely what you want:
Have a "Quit" button
Show a password dialogue when it is pressed
If it was correct, read an out of bounds array location (or do whatever) to crash the app
With that config installed you'd get stuck in whatever app you launch next, though.
You can't! You'll have to password protect the launch instead.
If you want to prevent the user from quitting your app, you'll need to physically cover the home button. This isn't a bad solution if your goal is to do something like a kiosk or a point of sale system, where you probably want to mount an iPad in a secure enclosure to prevent tampering or theft anyway. There are quite a few such enclosures on the market in a variety of styles.
For a normal app, though, there's really no solution -- iOS isn't designed for whatever you're trying to do.
The only way I could think to do what you want (which is to prevent access to certain apps) would be to replace the SpringBoard application (this is the method used by Apple itself in the App store models of the iPhone and iPad that restrict the things you can do on the devices). #owenfi pointed at one way to do that without jailbreaking, but in general it is limited: you won't be able to "exit" the app, you will basically just be able to run a single app.
How does the process of "asking if user wants to use Location Services" work?
I read here that a dialog at the installation appears, which asks the user if Location Services should be allowed or not. Does it mean that there is nothing to do for the developer, because the user can change this behavior in settings? So there is no "asking dialog" to implement and no storing in system settings? Does the app need a settings menu where this behavior can be changed?
What is if I want such a settings menu in my app?
The only thing the developer has to be aware of is to check in his code if it is allowed or not? See here.
Sounds reasonable isn't it ? Yes, that's it. No dialog to implement yourself, iOS manages that for you.
The user can change the settings in Settings/General/Location Service.