iPhone- Open Settings from my application iOS 6 - iphone

I know there are many questions related to this.
1) is it possible to open Settings App using openURL?
2) Opening the Settings app from another app
3) iOS Launching Settings -> Restrictions URL Scheme
I have followed these questions for reference but that does not solve my query. I know that using openURL method you can open Settings but that was valid for only iOS 5.0 - 5.0.1. In iOS 5.1 it was deprecated.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs://"]];
Still I have been seeing lot of Apps mainly location based which asks for user permission to turn on Location Services and takes directly to Location Services under Settings--> Privacy. The screenshot of an App, which is installed on iOS 6.1 running device, below shows that tapping on Settings take you to directly Location Services.
I tried to run code in my App but it is not working (I want to take user to Settings page to allow my app to access contact information directly from my App). If Apple has disabled URL Schemes for this how come many Apps are still using it?

For apps that tie into services such as Location, the first time they request access the OS will throw out the alert with buttons that link to Settings. This isn't actioned by the app, but by the underlying security of the OS.
iOS 6 removed the ability to do this yourself as you mentioned.

You can open settings app programmatically in iOS8, but not in earlier versions of iOS.
In Swift:
UIApplication.sharedApplication().openURL(NSURL(string:UIApplicationOpenSettingsURLString));
Swift 4:
if let url = NSURL(string: UIApplicationOpenSettingsURLString) as URL? {
UIApplication.shared.openURL(url)
}
In Objective-C
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];

Related

Switching from View 1 to Bluetooth settings..can't possible?

I am facing problem in switching from view 1 to Bluetooth settings i.e in view 1 i have given 1 Button..on clicking on that button i want to switch to view 2(Bluetooth settings)..but it can't be possible in iPhone..since we can't access the default settings of iPhone..for that we have to create the application preferences..
Q.1 Is there any way to access the default settings of Bluetooth in iPhone?
Q.2 Is there any official link where it can be mention that we can't access the default settings?
I want suggestion..please help..
Thanks in advance
Apps cannot open the settings application to a specific screen. The reason that apps like MapMyFitness open preferences is because they ask for permission to use Bluetooth Low Energy. Asking for permission is managed by CBCentralManager on first usage.
These popups are shown automatically by the system framework. The message can be customized using the purpose property for location services, that is not possible in case of Bluetooth.
No private API was used for this, so there's no reason for the app to be rejected.
Credit goes to this bellow SO question
how some apps can open setting app programmatically within their app
que 2.
At previous we are opening Setting Page from app Using Bellow line of Code:-
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs://"]];
But now upto ios5.0 it was working after that this one depreciated. and Till now Apple not providing the URL Schema for achieving this one in newer versions.
Links of similar question and it's Answer:-
Call the official *Settings* app from my app on iPhone
iPhone- Open Settings from my application iOS 6
is it possible to open Settings App using openURL?
Programmatically opening the settings app (iPhone)
How can I open the Settings app when the user presses a button?
iPhone: Opening Application Preferences Panel From App
Open UIPickerView by clicking on an entry in the app's preferences - How to?
Open the Settings app?

Iphone:Taking the user to setting menu if internet is not connected

I followed this link iPhone reachability checking
but can anyone help me with if the user has not connected to internet how to take him to setting menu
If your application only supports iOS 5 and below target version then you can use below code to achieve this.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs://"]];
Please note that this is diable in iOS 5.1.
In iOS 5.0 and 5.0.1 you can use this:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs://"]];
However, in iOS 4.3 and older and in iOS 5.1 and later, this URL scheme is not associated with the Settings app - if you want your app to be accepted in the AppStore, you don't really have any option other than asking the user to go to Settings. However, if jailbroken/non-AppStore development is an alternative, you can use a private function for opening an app:
SBSLaunchApplicationWithIdentifier(CFSTR("com.apple.preferences"), false);
This function is located in the SpringBoardServices private framework.
I should make a NSTimer within you appdelegate which loops (for example each 30 seconds). When this method is fired (on every 30 seconds) you check for the current internet connection. If this connection fails then you navigate to the settingsviewcontroller else you do nothing.

Opening iCloud.app in iPhone application

How to open iCloud.app in my own iPhone application? The only information I have ables me to open Setting.app through this line of code
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs://"]];
but I want to check if the calender is on/off in iCloud on the iPhone.
So when I run my own application I want to move directly in iCloud through my application.
How to access iCloud in iPhone applications?
There is no such app as the iCloud app. I presume you are talking about the iCloud menu in the settings app, there was a brief time in iOS 5.0 where you could use the prefs:// URL scheme to access menus in the settings app, however Apple disabled that in the very next update.
Hopefully it wills return in the future, but even if it does there will still be no way to programmatically determine the status of settings (such as icloud calendar sync) or manipulate the settings.

Autostart of an iphone app

I am building GPS Tracking app. I want the tracking functionality to be started
after a reboot of device. Now I did with background compatibility, It works fine on background, but I need to start tracking when the device is rebooted (switch on) without having to open the app to start the functionality.
How can I implement that. Please give me procedure for how to enable the autostart for
that app and how to invoke a method to start tracking.
If you watch the app like skype and webEx that are autostarted on iphone starts..
How these apps are working. I have no idea for enabling this autostart.
Please suggest me how to do?
Thanks in advance...
Add the UIBackgroundModes key to your app’s Info.plist file. Set the value of this key to an array that includes the voip string.
You can do that in xcode: Select your project root -> Capabilities -> Background Modes -> check 'Voice over IP'.
From the documentation:
"An app with this key is also relaunched in the background immediately after system boot".
No third party app can be launched on startup. Skype (and others) simple respond to push notifiactions
The only way to actually open an app from the user not explicitly opening it, is to call a [[UIApplication sharedApplication] openURL]; - or somehow otherwise open a URL, and you have to set your app up to have a custom URL scheme... see this page.
E.g: Doodle jump has URLs such as doodlejump://highscores - which you can open from an email from them or their website.

iPhone: Start or Download App if not exists from Safari

I know its possible to open an app from mobile safari using custom URL Handlers.
Is it possible to open the App Store from Safari on the iPhone and automatically install the app?
Or might it even be possible to open the app if it exists on the users device and to download it if it doesn't?
Best,
heinrich
You can't automatically install the app, but you can go to an App Store URL via UIApplication's openURL: method.
To open another app from within yours, see this question: Launch an app from within another (iPhone). (I don't know how you'd find out if the other app is installed. Maybe just try to open it, and if that fails, open the App Store URL?)