Is it possible to call alert "Allow to use current location" manually? - iphone

Is it possible to call alert "Allow to use current location" manually when using CoreLocation framework?

No, it's automatically displayed when the app accesses Core Location. If the user rejects it, it's displayed a second time at the next launch, then it keeps quiet and isn't shown anymore.
See this answer how to detect if the user rejected the request.

Related

Swift CLLocationManager: How to change status from "Don't Allow" to "Allow" by popping up Authorization Dialog again

CLLocationManager requestWhenInUseAuthorization Authorization dialog works only for once.
How to change status from "Don't Allow" to "Allow" by popping up the same Authorization Dialog again.
So, as you already figured it out you can check for authorizationStatus. Once you check that the user has denied you access, you can always use custom alert (dialog) for telling the user, he/she needs to permit your app to use Location. A good way to do that is adding Alert option that navigates him to the Settings of your app, as you have found out, you can do that with: UIApplicationOpenSettingsURLString.
A good tutorial on this subject is: http://nshipster.com/core-location-in-ios-8/
Also, I would recommend you to take your time and look at the Apple doc site (this always helps me see the big picture): https://developer.apple.com/documentation/corelocation/cllocationmanager
You can't I don't believe, if the user has denied your app access to their location you have to instruct them to turn it on in their settings.

Photo Library/Camera settings programmatically

I want to enable Camera/Photo library settings for my application. Can i show the alert to enable these programmatically
like when application starts. I have attached picture to show i want to see similar settings for my application
for my application, I am not seeing this settings.
My problem is this application runs in Guided access mode and once user put the application in guided access modes,
application is not getting an iOS alerts , so the default alerts will not come and user will not be able to enable access to photo library.
i have keys description in plist file.
Is there any way i can enable these settings in beginning of application.
No. You can request access programmatically but the request pops up the alert and waits for the user to accept or deny access. There is no way to enable the access without the alert.
If this could be done then it would completely negate the whole point of the user having control over what an app can access or not.
Based on your comments below, you need to know how to programmatically request authorization so the alerts can be responded to.
Use AVCaptureDevice requestAccess(forMediaType:completionHandler:) request access to the camera.
Use PHPhotoLibrary requestAuthorization(_:) to request access to the photo library.
For a better UX, don't make the 2nd request until the 1st one is complete.

how to set text in another app for ios

Is it possible for an app to
Detect whether the last app used by user is WhatsApp.
Open WhatsApp and set text.
Set text directly in the opened conversation.
No, you can not access the app history.
Yes, you can using url-schemes. Read Whats App's documentation.
See 2
Simply No.
You cant access the user history.
You cant open another app within another app.
You cant access another app.

iOS, CLLocationManager: Displaying the "reenable Location Services" Popup

if location services are turned off (after the user once did allow the service) and you then start location updates, a system popup should appear. (the documentation says so in the description of [CLLocationmanager locationServicesEnabled])
But if I setup a test project, which just initialises a CLLocationManager and then calls startLocationUpdates, the popup does NOT appear on every app start. But it should if I understand the documentation right?
I am not talking about the first popup, which asks the user to allow or deny location use for that app. I am talking about the popup, which asks the user to reenable the location services in the settings. That popup has a direct button to the settings application. You can see it, if you disable location services and than open up the maps app. Everytime you press the locate-me button now, the popup appears. Screenshot:
I want it to show up reliably on every app start in case the services are disabled. (other apps do it the same way, e.g. aroundme)
Thanks, Markus
The Popup will only appear once (in some cases twice) for the lifetime of an app!
That is the result of my tests. If anyone has additional information, feel free to write / contact me!
Thanks.

Location services alertview

When we use libraries of location services in our app it automatically show the alert box when we launch the app with don't allow and Ok buttons.
Is it possible to disable the don't allow button? And is there any variable set when we press don't allow or OK button?
Do you mean when the alert asks the user if they want to allow your application to use location services ? If so then no, you cannot override this. This is so that the user is not only aware that their location is benign tracked but also that this data is going to be used by the application. Would you want an application tracking you and potentially uploaded your location without your knowledge ?
As for the variables, pressing yes will tell iOS that it is allowed to track you data, saying no will do the opposite so any maps or locations based services will not be able to retrieve user location.