This question already has answers here:
How to check programmatically if an App is installed?
(6 answers)
How can I determine if a user has an iOS app installed?
(4 answers)
Closed 9 years ago.
On iOS, you can launch the Facebook app and link to a profile by opening a url like this: fb://profile/12345
The only problem is that if the Facebook app isn't installed, nothing happens.
Is there a way to detect if the app is installed or if the url scheme fb:// is supported?
This would apply broadly to other apps like Twitter as well.
BOOL isInstalled = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"fb://"]]
if (isInstalled) {
} else {
}
Try just using the canOpenURL: function
NSURL *fbURL = [NSURL URLWithString:#"fb://"];//or whatever url you're checking
if ([[UIApplication sharedApplication] canOpenURL:fbURL])
{
//open it etc
}
Related
This question already has answers here:
iOS 9 not opening Instagram app with URL SCHEME
(14 answers)
Closed 4 years ago.
I am trying to check whether Spotify is installed on iPhone with my code and Spotify is already installed on my device. However its always in else block in code below
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"spotify://"]]) {
//open spotify
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"spotify://"]];
}
else
{
[SVProgressHUD showErrorWithStatus:#"Spotify was not installed"];
[SVProgressHUD dismissWithDelay:1.00];
}
However I can successfully open Spotify with the code below:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"spotify://"]];
I am wondering why canOpenURL is not working for Spotify while it works for Apple Music with music:// URL Scheme.
if ([[UIApplication sharedApplication] canOpenURL:
[NSURL URLWithString:#"spotify://"]])
{
NSLog(#"App Found");
}
else
{
NSLog(#"App Not Found");
}
If your app is linked on or after iOS 9.0, you must declare the URL schemes you want to pass to this method. Do this by adding the LSApplicationQueriesSchemes key to your app's Info.plist file. If you call this method for a scheme not declared using that key, this method always returns false, whether or not an appropriate app is installed. To learn more about the key, see LSApplicationQueriesSchemes.
This question already has answers here:
is it possible to open Settings App using openURL?
(4 answers)
Closed 7 years ago.
I am trying to open setting from my app in a button action, I know the following code works but how can I do similar thing on iOS 9?
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:#"General&path=Network/VPN"]];
Or is there any other way to open setting page from app?
If it is not possible can I open Wifi setting?
Found the solution:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=Safari"]];
You can do like this to open settings page from your app
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
This question already has answers here:
How to open Settings programmatically like in Facebook app?
(15 answers)
Closed 7 years ago.
In my iOS application, I'd like to make a method
that opens/launches the Settings Application,
>> particularly the WIFI page, where you pick a wifi SSID <<.
I know it is possible to open Settings App.
cf How to open Settings programmatically like in Facebook app?
Is it possible to land on the Wifi page of it?
If yes, how?
Now, using the UIApplicationOpenSettingsURLString you can get the URL used to open the Settings app.
Because this is iOS 8 only, on iOS 7 or earlier you will need to check this exists before using it (or your app will crash)
if(&UIApplicationOpenSettingsURLString != nil)
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}
Hope this helps you
This question already has answers here:
Opening the Settings app from another app
(18 answers)
Closed 8 years ago.
In my application first open alertview with button. if user click alertView button then i need to launch setting bundle in my device.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs://"]];
This is not working in IOS 7. Any having idea?
There is no way to do this.
Because till now (11th Jan 2013) there is no url scheme available for settings app.
Apple provides built-in support for the http, mailto, tel, and sms URL schemes.
I'm developing an app for iOS 6 with Facebook Share option. I need to check out that this app can able to check wether Facebook app was installed in device or not.
I have already tried with Account Store. But it was not working. Is there any some other way for this issue. I need help with code. Thanks in advance
You can test for it using -[UIApplication canOpenURL:]. The facebook custom URL scheme is "fb:".
NSURL *url = [NSURL URLWithString:#"fb://profile"];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
// Facebook is installed
}