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.
Related
Can we use a button to make a phone call from the apple watch app?
For iPhone app we can use once the button is pressed:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"tel://1111111111"]]);
openURL is silently ignored if the device is locked or the app is in the background. Additionally WatchKit doesn't contain an API for initiating a phone call.
Your best bet may be to prompt the user to open the iPhone app, possibly using Handoff, and tap a button to initiate the call from there. Not a great solution, but WatchKit is pretty limited right now.
It's now possible from WatchOS2 :
if let telURL = NSURL(string: "tel:5553478") {
let wkExtension = WKExtension.sharedExtension()
wkExtension.openSystemURL(telURL)
}
cf1,
cf2.
You can't do this on Apple Watch itself. But there alternative ways like:
Tell the user to call the phone in the companion iPhone app
Use Handoff to jump from Apple Watch app to the companion iPhone app with just a tap on a button (a more user-friendly way)
NOTE: The best way is always waiting for new versions. In WWDC 2015 taking place in San Francisco (June 8-12), they will introduce WatchKit 2 with support for the companion kits on iOS and the native watch apps that run on Apple Watch without having the iPhone nearby.
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]];
i tried these commands-
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=LOCATION_SERVICES"]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=General"]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=Wallpaper"]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=Safari"]];
These codes opens Location, General, Wallpaper and Safari respectively in iOS 5.0 but nothing works in iOS 5.1.1
Anyone have any idea?
In iOS 5.1, the prefs: URL scheme has been removed. You can't use it anymore.
If using private APIs is an option, you can try this:
SBSLaunchApplicationWithIdentifier(CFSTR("com.apple.Preferences"), false);
You have to link against the SpringBoardServices framework then.
Just a quick addition to #H2CO3's answer (that wouldn't fit in comments). I was using that solution in my Cydia app to open the settings, combined with an entitlements file containing the following entry:
<key>com.apple.springboard.launchapplications</key>
<string>true</string>
This was I believe the way Xcode formatted the entitlements file. And this worked fine on my two test devices. However, several beta testers mentioned that the settings app wasn't being opened. I noticed that several examples of entitlements files used a different format to indicate the value of a key:
<true/>
I tried this out on a device that didn't work with the first entitlements entry, and the settings app actually opened.
So I'm posting this in case anyone else has a similar problem. (Running the app as root may also be a solution, but I didn't try that.)
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.
I use the following code to list all my applications in the App Store.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"itms-apps://itunes.com/apps/AbcCompany"]];
It works fine on iOS 4.3 but lists nothing on iOS 5. Does anybody know how to solve it?
Please check whether apple approve that apps, if it approved app means then only you can see on iTunes before that it does not open.
Please follow this structure:
itms://itunes.apple.com/us/app/my-app-name-is-new/id389921?mt=8
If you need further information contact me