I know it is possible to open up your app's own settings:
if (&UIApplicationOpenSettingsURLString != NULL) {
NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
[[UIApplication sharedApplication] openURL:url];
}
else {
// Present some dialog telling the user to open the settings app.
}
However, I need to open up a screen in the system settings. Specifically this one (the screen that contains the "Add New Keyboard" button, or even better, the screen right after that screen):
What do I need to do to implement this functionality in a button? (Answers in swift or objective-C are fine)
Related
I have implemented functionality in my App to open it in App Store via iTune Link of my App. The issue that I am facing is that whenever my App is updated on App Store and I go to it by clicking the update button inside my App, the open button appeared in App Store instead of the Update button.
When I go to App Store and find my App then it displays the update button but now when I go via my App.
(On Update button click I am doing this)
NSString *iTunesLink = #"itms://itunes.apple.com/qa/app/my-App/id1123444387?mt=8";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:iTunesLink]];
Does anyone know what might be causing this issue? Any kind of help would be greatly appreciated. Thanks
Also
I wanted to convert this swift code to objective c.
let urlStr = "itms://itunes.apple.com/qa/app/my-App/id1135248687?mt=8"
if #available(iOS 10.0, *) {
UIApplication.shared.open(URL(string: urlStr)!, options: [:], completionHandler: nil)
} else {
UIApplication.shared.openURL(URL(string: urlStr)!)
}
Appstore App, has tabs one tab is dedicated for showing update available for apps installed on iPhone/iPad.
it is not possible to navigate user to update tab, in past I have tried similar but seems not possible.
swift converted -
let urlStr = "itms://itunes.apple.com/qa/app/my-App/id1135248687?mt=8"
if #available(iOS 10.0, *) {
}
do {
UIApplication.shared.open(URL(string:urlStr)
, options
, completionHandler
nil
}
do {
UIApplication.shared.openURL(URL(string:urlStr)
}
converted using online tool
Disclaimer I am not associated with above mention product, I have just used it and finds ok, hence recommending
ObjC code:
NSURL * urlStr = [NSURL URLWithString:#"itms://itunes.apple.com/qa/app/my-App/id1135248687?mt=8"];
if(#available(iOS 10.0,*)){
[[UIApplication sharedApplication] openURL:urlStr options:#{} completionHandler:nil];
}else {
[[UIApplication sharedApplication] openURL:urlStr];
}
As for the update button problem check your link as it may be pointing to a different location.
In your case it should look something like this:
#"itms://itunes.apple.com/app/apple-store/id1135248687?mt=8"
Can I display the list of wifi access points on UI dialog & allow user to switch wifi settings from within my app by using swift 3?
OR
Is it possible to open the wifi settings on a prompt dialog which does not cover full screen?
No. Check this answer.
It may help you
Objective C
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"prefs:root=WIFI"]]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=WIFI"]];
} else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"App-Prefs:root=WIFI"]];
}
Swift
if UIApplication.shared.canOpenURL(URL(string: "prefs:root=WIFI")) {
UIApplication.shared.openURL(URL(string: "prefs:root=WIFI"))
}
else {
UIApplication.shared.openURL(URL(string: "App-Prefs:root=WIFI"))
}
I tried to open facebook app using this
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"fb://"]];
when my app is running in foreground , it works fine but if my app is in background it didn't work .
help me out .
I'm very new in programming
You are think impossible task. Think and first ask your self what are you trying.
Your app in to background it means (minimized). then where to trigger for calling open Facebook Native app method.
If app in background then you can't have any event for handle your app event from iPhone screen.
That bellow code for open Fb native app from app. but from background it out of logic think. that not relevant at all.
you can open facebook app using this bellow :-
- (IBAction)OpenFB: (id) sender
{
NSURL* facebookURL = [NSURL URLWithString: #"fb://profile/157893597658332"];
UIApplication* app = [ UIApplication sharedApplication ];
if( [ app canOpenURL: facebookAppURL ] ) {
[ app openURL: facebookAppURL ];
} else {
// url wrong
}
}
Here it is very nice Article
http://www.plungeinteractive.com/blog/2012/12/31/open-facebook-and-twitter-native-apps-from-your-ios-appgame/
UPDATE:-
I dont think this is suitable for your requirement but using Custom URL Scheme. you can able to Open your app from from safari browser or other app. just setting URL type--> setting URL schemes like bellow
and then try like i did in bellow image that open your app from browser:-
You cannot launch another app from the background mode because that would be pre-empting the user's current task without user interaction. There is only one application that is permitted to pre-empt the user's current action and that is the phone in the case of an incoming call.
What you could do is display a local notification and if the user actions that notification to launch your app - placing it back into foreground - then you could launch Facebook.
UILocalNotification* localNotification = [[UILocalNotificationalloc] init];
localNotification.fireDate = nil;
localNotification.alertBody = #"I want to launch Facebook";
localNotification.timeZone = nil;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
then in your app delegate -
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
// Handle launching from a notification
UILocalNotification *locationNotification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
if (locationNotification) {
// Open Facebook
[application openURL:[NSURL URLWithString:#"fb://"];
}
return YES;
}
But if the user chooses not to action your notification there is nothing you can do.
currently I'm using UIWebView to make phone calls
NSURL *telURL = [NSURL URLWithString:[NSString stringWithFormat:#"tel://123456789"];
[self.callWebview loadRequest:[NSURLRequest requestWithURL:telURL]];
when I touch on a button to make call, an UIAlertView appears and ask for confirmation with title 123456789
How can I change its title and message ?
Thanks.
Don't use a UIWebView, just present a UIAlertView to the user asking if he/she want to call. Also there are no // in the tel: scheme, so tel:123456789 is correct.
Then just open open the tel: url via [[UIApplication sharedApplication] openURL:telURL].
Also do not forget the check whether the users device can make phone calls:
NSURL *telURL = [NSURL URLWithString:#"tel:123456789"];
if ([[UIApplication sharedApplication] canOpenURL:telURL]) {
// Present the user with the dialog to start the call
} else {
// inform the user that he/she can't call numbers from their device.
}
Since iOS6, I can't tell whether the application can launch Safari or not.
If Safari is restricted on the device (Settings>General>Restrictions), nothing happens when trying to open a URL, and there's no indication of what went wrong:
NSURL *url = [NSURL URLWithString:#"http://www.google.com"];
[[UIApplication sharedApplication] canOpenURL:url]; // Returns YES
[[UIApplication sharedApplication] openURL:url]; // Returns YES
However, Safari does not launch, and the user is left wondering why my buttons are "broken".
This seems like a bug to me so I filed a radar #12449905.
Is there another way to solve this problem?
If this is an Apple bug, then it looks like the thing for you to do is to program around it. Once the user clicks the button, you can always write something like this:
[self performSelector:#selector(notifyUserOfRestrictedAccess) withObject:self afterDelay:.5];
In the app delegate, you can set a property such as:
- (void)applicationWillResignActive:(UIApplication *)application {
self.openingExternalProgram = YES;
}
In your view controller, create the method like this:
-(void) notifyUserOfRestrictedAccess {
if (!appDelegate.openingExternalProgram) {
// Message the user via UIAlertView about restricted Safari access
}
appDelegate.openingExternalProgram = NO;
}
I'm sure there are better ways, but at least you don't have to wait on Apple.