Can someone tell the URL schemes to open the Facebook application from my app?
Use fb://
.
canOpenURL
returns a BOOL
value indicating whether or not the URL’s scheme can be handled by some app installed on the device. If canOpenURL
returns YES
then the application is present on the device. If the user has Facebook installed on their device we open it. If the user does not have Facebook installed we open the page through a link, which will launch Safari.
// Check if FB app installed on device
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fb://"]]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"fb://profile/355356557838717"]];
}
else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.facebook.com/DanielStormApps"]];
}
Check out iPhone URL Schemes for a list of what else you can achieve via URL Schemes.
Also, starting at iOS 9 you must include LSApplicationQueriesSchemes
in your info.plist
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With