I am new to the objective C programming and I am in a position where I need to create an iPhone App really quickly. I am using XCode 4.2
I have found a method to get the user country (using NSLocale)
I assume that the application will ask the user if he wants to use his/her current location for that?
if the user says "don t allow" how can we manage that , what are the functions that can be used ?
Thanks
The Core Location methods automatically handles user permission, if that's what you're asking. If the user says he doesn't want his location to be used, well, handle it the way you want : display an error message, of it is crucial to your app, display an alert saying how location is crucial to your app, and exit it. Or something else, it's up to you.
You can check if the location services are enabled system-wise with [CLLocationManager locationServicesEnabled]. For your app only, when getting the location fails, the - locationManager:(CLLocationManager*)manager didFailWithError:(NSError*)error message is sent to the location managed delegate. You can check the error domain/code to have more details
Related
I am making a voicemail app for iOS. In this app i want two things-
Call status - If i called someone then how will i get the status of his i.e. it is busy or not reachable or switch off or call disconnected.
Phone no - If i get the status of call then how can i send voicemail on another user phone. Can i get the another user's phone no.
This is not an app to app application. I am getting caller by making him register through my app BUT by which mean i can get the number of the user who called??? Does apple provide this type of permission.
For your first question:
Post1
Post2
For your second question, there is no way for you to retrieve the caller's phone number. CoreTelephony only gives you limited access to the information such as a unique identifier for your calls and call state. To get more information, you're definitely going to have to use some low-level functions and jailbreak which means it will not be accepted into the Appstore.
I used Location Manager API for find out Latitude and Longitude of the current place.
But when i called update location manager method i get some alert from application which i have attach along this message.
I want to remove this alert message and by default i want to set YES or (Allow) for that.
Is it possible or not?
Thank You
Its not possible to do that. It is done to safeguard user's security. If you've been following the PATH ADDRESSBOOK issues, it was raised 'coz Path App didn't ask users before using their Address Book. So Apple's implemented the asking feature or permission by default in Core Location and Push Notifications. And By the looks of it, in the address book as well and you will have to stick to it - After all, you don't want to fall into privacy issues. :)
It is not possible,This dialog would be shown once when the app starts
You cannot and even if you could, probably your App wouldn't be accepted by Apple.
I want the following to implement in my app:
mobile app has to download a list of locations periodically [web service] , in background [even if the application is not running] .
Have to compare the user's current location with those downloaded locations each time.[in background]
Have to alert the user if he is near that location.[push notification]
Can we implement these things [is it possible to call webservice in background]while app is not active ? I have searched a lot and now assuming that calling webservice while app is not in active state is not possible. Kindly confirm.
You can do the 3 task i.e to alert the user using push notification.
As in the inactive state, your app can only receive push notification.
You cannot call a webService.
1: it is impossible to do action if the app is not running
2: it is possible, you can find example for this purpose from iOS SDK document library
3: the app have to running and detect current location real time... when near POI then notify user, about APNS, the same way... the app have to post the current location to back end web server, the web server need detect whether near POI, if yes... send notification via APNS...
hope above helpfully
In my application, I'm using location information to capture the user locations.
I have the following questions:
What are the alert messages we have to provide in the application for user to show that we are going to use their location?
Can we fetch the location info in the background once the user accept that?
If user is allowed to fetch the location information let's say in the first time the application launches, do we need to provide the alerts for consecutive fetches (in next app loads)?
Thank you.
None, iOS will do this automatically.
This is the normal procedure.
iOS will bug the user as it is programmed to do.
If you assign the purpose property to your location manager instance, it will include that in the popup that asks the user for permission. See http://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html#//apple_ref/doc/uid/TP40007125-CH3-SW30
Yes for the other two.
I'm not an iPhone programmer, but I'm an iPhone user. Every time an application has asked for access to my location information, once I say yes it never asks again and regularly uses it.
This leads me to believe that the answer to your questions is:
1) Probably the alert message is provided automatically the first time your application requests location information. I'm pretty sure they aren't relying on developers policing themselves.
2) Yes, I believe so.
3) Yes, I believe so.
My application asks for location at the log in screen, and right now, the user can log in without sharing his or her location. When the user selects "No" for sharing location, an error that reads Error Domain=kCLErrorDomainCode=1 "The operation couldn't be completed. (kCLErrorDomain error 1.)" is thrown. I'm guessing that's because I am trying to access latitude and longitude without having such things.
My question is, how do I make sure that a user allows location before anything else can be done? Is there a way to create a new "Allow Location" pop-up request?
Thanks in advance!
You would need to implement locationManager:didFailWithError.
The documentation states that:
If the user denies your application’s
use of the location service, this
method reports a kCLErrorDenied
error. Upon receiving such an error,
you should stop the location service.
Additional information is here
My suggestion would be have your application cope with the situation where no location information is available, by informing the user that this is a requirement etc.
Repeating the dialog until you get the answer you want is just going to annoy the user.